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. Issues compiling modeltest with Qt 5.1

Issues compiling modeltest with Qt 5.1

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 2.2k Views 1 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    I've just finished (kinda) working on my QAbstractItemModel subclass, trying to verify it with "modeltest":http://qt-project.org/wiki/Model_Test. After editing some more obvious errors I'm left with one compilation error in method ModelResetCommand::emitPostSignal(), which looks like this:

    @void ModelResetCommand::emitPostSignal()
    {
    m_model->reset();
    }@

    The error is 'reset' is not a member of 'DynamicTreeModel', where QAbstractItemModel is a QAbstractItemModel subclass that does indeed have no reset() method. Ideas anyone?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #2

      Sorry, but what is your point? If m_model does not have a function "reset()", you cannot call it. It just will not work.

      If m_model is secretly of a different kind that has access to a reset()-function, cast it to that kind before calling the function.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by
        #3

        The point is this is a module from Qt repository that's supposed to work out of the box.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thEClaw
          wrote on last edited by
          #4

          What kind of object is m_model?

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Violet Giraffe
            wrote on last edited by
            #5

            DynamicTreeModel, which is a subclass of QAbstractItemModel. Source code: https://qt.gitorious.org/qt/qt/source/57756e72adf2081137b97f0e689dd16c770d10b1:tests/auto/modeltest

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thEClaw
              wrote on last edited by
              #6

              I do not see the connection between your problem and the Model_Test. In your very own slot (right?) you are requesting a function of an object created by you, and that function is implemented at no point. Did you maybe mean "resetInternalData":http://qt-project.org/doc/qt-5.1/qtcore/qabstractitemmodel.html#resetInternalData ? If not, you will have to implement a function called "reset" or nothing will happen.

              If I understand correctly, the Model_Test will abort your application if some kind of error pops up during runtime. If the application doesn't compile in the first place, the error should be found somewhere else.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Violet Giraffe
                wrote on last edited by
                #7

                No. What I'm talking about is an error compiling modeltest.cpp from the repository.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  thEClaw
                  wrote on last edited by
                  #8

                  Ok, it seems I misunderstood you, sorry.

                  "reset()":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#reset has been a member of QAbstractItemModel before Qt 5 and was then moved to the "Compatibility Members":http://qt-project.org/doc/qt-5.1/qtcore/qabstractitemmodel-compat.html .
                  It seems there is no single replacement for reset(), and therefore you may have found a bug, depending on where you dug up your line of code.

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    Violet Giraffe
                    wrote on last edited by
                    #9

                    Fair enough, I guess modeltest hasn't been adapted to Qt 5 yet. Thanks.

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

                      Hi,

                      You could have a look at the "bug report system":http://bugreports.qt-project.org to see whether there's already something about this. If not, create a new bug report with a minimal example that reproduces the problem.

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

                      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