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. Reusing QtCore module in any C++ project

Reusing QtCore module in any C++ project

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 4.5k 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.
  • I Offline
    I Offline
    Iakov Minochkin
    wrote on last edited by
    #1

    I'm very interested in reusing metaobject system and general functionality, but don't know exactly:

    • Has QMetaObject::invokeMethod() dependency on event loop?
    • Can I load plugins without QCoreApplication instance?
    • ...

    Some list of using restrictions of this module in non-qt application/in non-main thread would be greatly appreciated.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      If you want to extract code of Qt, I'm afraid you must carefully read the code an check it your self.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Iakov Minochkin
        wrote on last edited by
        #3

        I only want to bind with QtCore library and to use at least moc and resource compilers.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          The easiest way to find out such things is usually a try. To spoil your first question: DirectConnection doesn't, QueuedConneciton does. As to your second question: if you do something that requires a QCoreApplication instance there is usually a warning issued or your application aborts immediately.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            Iakov Minochkin
            wrote on last edited by
            #5

            bq. To spoil your first question: DirectConnection doesn’t, QueuedConneciton does.

            thank you, logic!)

            bq. The easiest way to find out such things is usually a try

            yes of course, but if I want suggest to Nokia to publish some documentation about this problem what should I do?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              The usual way is filing a suggestion to "JIRA":https://bugreports.qt.nokia.com/ or compiling such a list on your own and submitting it to the "Qt project":http://www.qt-project.org/.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #7

                If you use QMetaObject qithout QObjects, you could get some compiler problems. In the interface of QMetaObject, you can see:

                bool invoke(QObject *object, ...
                

                And all methods, that are used for signal/slot handling use QObject pointers.

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  Iakov Minochkin
                  wrote on last edited by
                  #8

                  bq. If you use QMetaObject qithout QObjects, you could get some compiler problems. In the interface of QMetaObject, you can see:
                  bool invoke(QObject *object, …

                  It's clear that not possible to use metaobject system without inheritance from QObject, Q_OBJECT macro and moc compiler.

                  bq. And all methods, that are used for signal/slot handling use QObject pointers.

                  Signal/slot handling can't be done without event loop as I understand and that's why I can't use QObject::connect() without QCoreApplication::exec().

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    I think signal/slot handling can be done without having an eventloop, but only if you use direct connections only. By default, signal/slot connections are direct, unless the thread the emit happens in is different from the thread in which the object lives. In that case, a Queued connection is used, which does need an eventloop. Lukas already explained that earlier in this topic.

                    QObject is quite fundamental to using any of the nice Qt features, so I see little chance of getting around it. However, I think quite a bit can be done without using a QCoreApplication, though I think GUI stuff and sockets and the likes of those are off.

                    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