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. Compile bug porting fromQt4 to Qt5
Forum Updated to NodeBB v4.3 + New Features

Compile bug porting fromQt4 to Qt5

Scheduled Pinned Locked Moved General and Desktop
12 Posts 6 Posters 9.8k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Do you have have somewhere in your code a signal or slot that has a QList<QByteArray> pointer as a parameter ?

    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
    • D Offline
      D Offline
      DBoosalis
      wrote on last edited by
      #3

      Hi SGaist.

      Thank you for the reply. Yes, it was not in the offending moc file, but I do see that I make use of a QList<QByteArray>. I guess I have to register this type, but not sure how as of yet. Any hints ?

      Thanks again
      David

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

        Use "Q_DECLARE_METATYPE":http://qt-project.org/doc/qt-5.0/qtcore/qmetatype.html#Q_DECLARE_METATYPE and "qRegisterMetatype":http://qt-project.org/doc/qt-5.0/qtcore/qmetatype.html#qRegisterMetaType and you should be good

        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
        • D Offline
          D Offline
          DBoosalis
          wrote on last edited by
          #5

          Ok, will give it a try when the work day ends. I really apprciate you taking the time to help here.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dv879
            wrote on last edited by
            #6

            Hi,
            I'm having this exact same problem too.
            I'm also using QList<QByteArray> in my code, but not as a parameter to any signal or slot.
            Can you please explain what the problem with QList<QByteArray> is and how can I fix this?

            Edit: I just looked at my compile output and I think the problem on my side is actually in these 2 lines:
            ......\Tools\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qmetatype.h: In instantiation of 'int qMetaTypeId(T*) [with T = QList<TRSite*>]':
            ......\Tools\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qmetatype.h:656:29: required from 'int qRegisterMetaType(T
            ) [with T = QList<TRSite*>*]'

            I have in my mainwindow.h the following:
            QList<TRSite*> list[10];

            But I have no idea why it is not compiling. Any suggestions what should I do?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dbzhang800
              wrote on last edited by
              #7

              Hi, in which case your QList<TRSite*> list is used? QVariant/ Property/ signal and slots?

              If so, you should use Q_DECLARE_METATYPE and qRegisterMetatype to declare and register it.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bittoo
                wrote on last edited by
                #8

                Hi SGaist
                I am also facing the same issue too.

                @In file included from moc_ThreadController.cpp:9:0:
                ../TestCartetionProduct/ThreadController.h:52:30: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
                In file included from ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qobject.h:55:0,
                from ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/QObject:1,
                from ../TestCartetionProduct/ThreadController.h:4,
                from moc_ThreadController.cpp:9:
                ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qmetatype.h: In instantiation of 'int qMetaTypeId(T*) [with T = QVector<BaseMassSpectrumDTO*>]':
                ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qmetatype.h:656:29: required from 'int qRegisterMetaType(T
                ) [with T = QVector<BaseMassSpectrumDTO*>*]'
                moc_ThreadController.cpp:96:102: required from here
                ../../../Qt5.0.2/5.0.2/gcc_64/include/QtCore/qmetatype.h:642:5: error: invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure<false>'
                make: *** [moc_ThreadController.o] Error 1
                22:00:07: The process "/usr/bin/make" exited with code 2.
                Error while building/deploying project TestCartetionProduct (kit: Desktop Qt 5.0.2 GCC 64bit)
                When executing step 'Make'@

                I am not able to follow up documentation of Q_DECLARE_METATYPE [qt-project.org] and qRegisterMetatype [qt-project.org].

                • May you give a small example of how to use them or refer some link where any example is given.

                Thanks
                Manoj

                Regards,
                Manoj Kumar Panwar,

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

                  Hi,

                  Here's an "example from the documentation":http://qt-project.org/doc/qt-5/custom-types.html

                  [edit: corrected link for latest current documentation: 5.3]

                  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
                  • B Offline
                    B Offline
                    Bittoo
                    wrote on last edited by
                    #10

                    Thanks SGaist, Its worked for me :)
                    This link also helped me to understand how to use signal/slot with the container classes and multi-threading "Queued Custom Type Example ":http://qt-project.org/doc/qt-5.0/qtcore/queuedcustomtype.html

                    Regards,
                    Manoj Kumar Panwar,

                    1 Reply Last reply
                    0
                    • jonecirJ Offline
                      jonecirJ Offline
                      jonecir
                      wrote on last edited by
                      #11

                      This is a broken link.

                      [quote author="SGaist" date="1377550906"]Hi,

                      Here's an "example from the documentation":http://qt-project.org/doc/qt-5.0/qtcore/tools-customtype.html[/quote]

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

                        Thanks, the link has been updated

                        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