Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Where is ModelTest?
Forum Updated to NodeBB v4.3 + New Features

Where is ModelTest?

Scheduled Pinned Locked Moved Solved General and Desktop
modelview test
5 Posts 2 Posters 1.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bveeloB Offline
    bveeloB Offline
    bveelo
    wrote on last edited by
    #1

    Hi,

    Qt used to have a testing framework for model/view models. It is still described in http://doc.qt.io/qt-5/modelview.html#3-5-debugging-with-modeltest. Hoever its repository seems to have disappeared. Where can I find it? If it was taken down, how are you supposed to do quality assurance on models nowadays?

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and welcome to devnet,

      Do you mean that one that is linked in the wiki page ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      bveeloB 1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Which can be find here for Qt 5

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        bveeloB 1 Reply Last reply
        2
        • SGaistS SGaist

          Hi and welcome to devnet,

          Do you mean that one that is linked in the wiki page ?

          bveeloB Offline
          bveeloB Offline
          bveelo
          wrote on last edited by
          #4

          @SGaist Yes! That is the one. The tutorial refers to Qt Labs, which sent me in the wrong direction.

          That repo seems to be just for Qt4, and limited to security fixes only. But since the tutorial is part of Qt 5.9 also, where do I go with my patches to make it work for Qt5? I have two: the first one eliminates a deprecated call to QAbstractItemModel::reset(), the second one reintroduces the .pri file referenced in the wiki. They work for Qt 5.6, I'm going to test them for Qt 5.9.

          From 0edb1bb79327fb7ebd21a3a7b17774bc91ebb322 Mon Sep 17 00:00:00 2001
          From: Bastiaan Veelo <Bastiaan@Veelo.net>
          Date: Tue, 8 Mar 2016 11:06:25 +0100
          Subject: [PATCH 2/2] Eliminate deprecated call to 
           QAbstractItemModel::reset().
          
          Change-Id: Iea8e7c89431eb8fb045dcc860f27ab835708a145
          ---
           tests/auto/other/modeltest/dynamictreemodel.cpp | 30 ++-----------------------
           tests/auto/other/modeltest/dynamictreemodel.h   | 19 +---------------
           2 files changed, 3 insertions(+), 46 deletions(-)
          
          diff --git a/tests/auto/other/modeltest/dynamictreemodel.cpp b/tests/auto/other/modeltest/dynamictreemodel.cpp
          index 6a75a3d..32bbb6c 100644
          --- a/tests/auto/other/modeltest/dynamictreemodel.cpp
          +++ b/tests/auto/other/modeltest/dynamictreemodel.cpp
          @@ -283,6 +283,7 @@ void ModelMoveCommand::emitPostSignal()
               m_model->endMoveRows();
           }
           
          +
           ModelResetCommand::ModelResetCommand(DynamicTreeModel* model, QObject* parent)
             : ModelMoveCommand(model, parent)
           {
          @@ -302,38 +303,11 @@ bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart
               Q_UNUSED(destParent);
               Q_UNUSED(destRow);
           
          -    return true;
          -}
          -
          -void ModelResetCommand::emitPostSignal()
          -{
          -    m_model->reset();
          -}
          -
          -ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent)
          -  : ModelMoveCommand(model, parent)
          -{
          -
          -}
          -
          -ModelResetCommandFixed::~ModelResetCommandFixed()
          -{
          -
          -}
          -
          -bool ModelResetCommandFixed::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
          -{
          -    Q_UNUSED(srcParent);
          -    Q_UNUSED(srcStart);
          -    Q_UNUSED(srcEnd);
          -    Q_UNUSED(destParent);
          -    Q_UNUSED(destRow);
          -
               m_model->beginResetModel();
               return true;
           }
           
          -void ModelResetCommandFixed::emitPostSignal()
          +void ModelResetCommand::emitPostSignal()
           {
               m_model->endResetModel();
           }
          diff --git a/tests/auto/other/modeltest/dynamictreemodel.h b/tests/auto/other/modeltest/dynamictreemodel.h
          index 8fd2a54..f6d6aa7 100644
          --- a/tests/auto/other/modeltest/dynamictreemodel.h
          +++ b/tests/auto/other/modeltest/dynamictreemodel.h
          @@ -88,7 +88,6 @@ private:
             friend class ModelInsertCommand;
             friend class ModelMoveCommand;
             friend class ModelResetCommand;
          -  friend class ModelResetCommandFixed;
             friend class ModelChangeChildrenLayoutsCommand;
           
           };
          @@ -163,7 +162,7 @@ protected:
           };
           
           /**
          -  A command which does a move and emits a reset signal.
          +  A command which does a move and emits a beginResetModel and endResetModel signals.
           */
           class ModelResetCommand : public ModelMoveCommand
           {
          @@ -178,22 +177,6 @@ public:
           
           };
           
          -/**
          -  A command which does a move and emits a beginResetModel and endResetModel signals.
          -*/
          -class ModelResetCommandFixed : public ModelMoveCommand
          -{
          -  Q_OBJECT
          -public:
          -  ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent = 0);
          -
          -  virtual ~ModelResetCommandFixed();
          -
          -  virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
          -  virtual void emitPostSignal();
          -
          -};
          -
           class ModelChangeChildrenLayoutsCommand : public ModelChangeCommand
           {
             Q_OBJECT
          -- 
          1.9.5.msysgit.0
          
          From e88b55e028630a8e41d2e800461d962a87e91c7e Mon Sep 17 00:00:00 2001
          From: Bastiaan Veelo <Bastiaan@Veelo.net>
          Date: Tue, 8 Mar 2016 11:05:46 +0100
          Subject: [PATCH 1/2] Reintroduce .pri to allow client code do model testing.
           This was present in Qt4.
          
          Change-Id: I65071a42e68068378836b7e8dcb99d7b208b72d1
          ---
           tests/auto/other/modeltest/modeltest.pri | 11 +++++++++++
           1 file changed, 11 insertions(+)
           create mode 100644 tests/auto/other/modeltest/modeltest.pri
          
          diff --git a/tests/auto/other/modeltest/modeltest.pri b/tests/auto/other/modeltest/modeltest.pri
          new file mode 100644
          index 0000000..988b9da
          --- /dev/null
          +++ b/tests/auto/other/modeltest/modeltest.pri
          @@ -0,0 +1,11 @@
          +INCLUDEPATH += $$PWD
          +DEPENDPATH += $$PWD
          +
          +SOURCES         +=  $$PWD/tst_modeltest.cpp \
          +		    $$PWD/modeltest.cpp \
          +		    $$PWD/dynamictreemodel.cpp
          +HEADERS         +=  $$PWD/modeltest.h \
          +		    $$PWD/dynamictreemodel.h
          +
          +
          +
          -- 
          1.9.5.msysgit.0
          
          1 Reply Last reply
          0
          • SGaistS SGaist

            Which can be find here for Qt 5

            bveeloB Offline
            bveeloB Offline
            bveelo
            wrote on last edited by
            #5

            @SGaist said in Where is ModelTest?:

            Which can be find here for Qt 5

            Oh thanks, somehow your second post did not show. Thanks a lot.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved