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. QObject factory in Qt Plugin(non-creator)
Forum Updated to NodeBB v4.3 + New Features

QObject factory in Qt Plugin(non-creator)

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 4.7k 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.
  • A Offline
    A Offline
    adam.bogocz
    wrote on last edited by
    #1

    Hi All,
    I have desribed my problem here http://stackoverflow.com/q/9070817/538239 .. I apreciate your help.. I am out of ideas...

    Thanks,
    Adam

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p-himik
      wrote on last edited by
      #2

      Are you sure that you've red QPluginLoader documentation carefully? Maybe I did not understand you correctly but QPluginLoader::instance() returns QObject* so there is no need to create multiple interfaces. To avoid linking errors just declare signals and slots in your ProtocolInterface (which is not actually an interface since it inherits QObject) as pure virtual.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adam.bogocz
        wrote on last edited by
        #3

        Thanks for reply. The problem is that after I remove Q_DECLARE_INTERFACE from ProtocolInterface class and Q_INTERFACES id deriving class I got "libdummyplugin.so: undefined symbol: _ZN17ProtocolInterface16staticMetaObjectE)" :( ... the error is printed during plugin loading. Any ideas?

        1 Reply Last reply
        0
        • P Offline
          P Offline
          p-himik
          wrote on last edited by
          #4

          It seems that QPluginLoader uses staticMetaObject and Q_DECLARE_INTERFACE creates it for interface. But I'm not sure about it.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            adam.bogocz
            wrote on last edited by
            #5

            IMHO it is caused by MOC, because DummyProtocolInterface is not directly inheriting QObject and the compiler is not MOCing that class because it expects metaObject in ProtocolInterface located in daemon project... I am not sure if it could even work like this, sice ProtocolInterface.h has not-defined virtual functions(and there is probably no compilation -> no MOC ) ?? What do you say?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              adam.bogocz
              wrote on last edited by
              #6

              My colleague has probably found the root cause... it should be in the project file of the plugin... header of ProtocolInterface should be included via HEADERS not via INCLUDEPATH :) .. it will check it when I came home

              1 Reply Last reply
              0
              • A Offline
                A Offline
                adam.bogocz
                wrote on last edited by
                #7

                So adding Interface header into plugins project file as HEADER += solved the problem :)

                1 Reply Last reply
                1

                • Login

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