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. Problems with my first widget plugin
QtWS25 Last Chance

Problems with my first widget plugin

Scheduled Pinned Locked Moved General and Desktop
widgetsplugin windows
8 Posts 4 Posters 2.9k Views
  • 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
    Andy314
    wrote on 22 Jun 2015, 16:44 last edited by Andy314
    #1

    Hello
    I tried to integrate my first widget-plugin in the designer.

    Here is the project file gererated from the wizzard. It is a simple subclassing from a checkbox with no additionl functions:

    TARGET      = $$qtLibraryTarget(awWidgetsPlugin)
    TEMPLATE    = lib
    HEADERS     = awcheckboxplugin.h
    SOURCES     = awcheckboxplugin.cpp
    RESOURCES   = icons.qrc
    LIBS        += -L. 
    greaterThan(QT_MAJOR_VERSION, 4) {
        QT += designer
    } else {
        CONFIG += designer
    }
    target.path = $$[QT_INSTALL_PLUGINS]/designer
    INSTALLS    += target
    include(awcheckbox.pri)
    

    I changed in the plugin the group-name:

    QString awCheckboxPlugin::group() const
    {
        return QLatin1String("awWidgets");
    }
    

    It compiles successfull and generates the dll in a subfolder of my project, but how can I start the integration in the designer.
    I have understooden that the following lines from the project file should do this task, but nothing happens.

    target.path = $$[QT_INSTALL_PLUGINS]/designer
    INSTALLS += target

    I checked the whole Qt path for this file but found it nowhere. Then I copied by hand my plugin.dll in the following folders:

    C:\Qt\Qt5.4.1\Tools\QtCreator\bin\plugins\designer
    C:\Qt\Qt5.4.1\5.4\mingw491_32\plugins\designer
    and restarted the designer but the widget paletted has no changed.

    What must I correct ?

    PS:
    I found this code

    #if QT_VERSION < 0x050000
    Q_EXPORT_PLUGIN2(awcheckboxplugin, awCheckboxPlugin)
    #endif // QT_VERSION < 0x050000
    

    What is not active for my Qt version. Removing of the switches gives a compiler error.
    How to activate the the plugin in Qt versions >= 5 ?

    A 1 Reply Last reply 23 Jun 2015, 17:27
    0
    • A Andy314
      22 Jun 2015, 16:44

      Hello
      I tried to integrate my first widget-plugin in the designer.

      Here is the project file gererated from the wizzard. It is a simple subclassing from a checkbox with no additionl functions:

      TARGET      = $$qtLibraryTarget(awWidgetsPlugin)
      TEMPLATE    = lib
      HEADERS     = awcheckboxplugin.h
      SOURCES     = awcheckboxplugin.cpp
      RESOURCES   = icons.qrc
      LIBS        += -L. 
      greaterThan(QT_MAJOR_VERSION, 4) {
          QT += designer
      } else {
          CONFIG += designer
      }
      target.path = $$[QT_INSTALL_PLUGINS]/designer
      INSTALLS    += target
      include(awcheckbox.pri)
      

      I changed in the plugin the group-name:

      QString awCheckboxPlugin::group() const
      {
          return QLatin1String("awWidgets");
      }
      

      It compiles successfull and generates the dll in a subfolder of my project, but how can I start the integration in the designer.
      I have understooden that the following lines from the project file should do this task, but nothing happens.

      target.path = $$[QT_INSTALL_PLUGINS]/designer
      INSTALLS += target

      I checked the whole Qt path for this file but found it nowhere. Then I copied by hand my plugin.dll in the following folders:

      C:\Qt\Qt5.4.1\Tools\QtCreator\bin\plugins\designer
      C:\Qt\Qt5.4.1\5.4\mingw491_32\plugins\designer
      and restarted the designer but the widget paletted has no changed.

      What must I correct ?

      PS:
      I found this code

      #if QT_VERSION < 0x050000
      Q_EXPORT_PLUGIN2(awcheckboxplugin, awCheckboxPlugin)
      #endif // QT_VERSION < 0x050000
      

      What is not active for my Qt version. Removing of the switches gives a compiler error.
      How to activate the the plugin in Qt versions >= 5 ?

      A Offline
      A Offline
      Andy314
      wrote on 23 Jun 2015, 17:27 last edited by
      #2

      Supplement:
      I have the same Problem with the in the Designer integrated example:
      customwidgetplugin (AnalogClock)
      Examples should work!
      No additional plane in the dialog designer. What can be the problem?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 23 Jun 2015, 21:39 last edited by
        #3

        Hi,

        You're hitting the one pitfall with designer plugins: You Qt version + compiler must match the one used to build Qt Creator. For windows, currently and AFAIK, Qt Creator is built with Visual Studio (last time I check it was 2010, it might have changed in between)

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

        A 1 Reply Last reply 26 Jun 2015, 08:35
        0
        • S SGaist
          23 Jun 2015, 21:39

          Hi,

          You're hitting the one pitfall with designer plugins: You Qt version + compiler must match the one used to build Qt Creator. For windows, currently and AFAIK, Qt Creator is built with Visual Studio (last time I check it was 2010, it might have changed in between)

          A Offline
          A Offline
          Andy314
          wrote on 26 Jun 2015, 08:35 last edited by Andy314
          #4

          Hello @SGaist !

          Uff, this is a very big pitfall, but explaines much for me.

          The Qt binary package for windows is incompatible with itself!? This decreases my first enthusiasm on Qt very much. What is the idea from Digia behind this concept ???

          How solve other people this problem? Must I develop a plugin in old C++ style (VS10 is used) and develop an other with the same funktionality in MinGW for my running app? Is this possibe?

          The most logic solution would be to get the Designer compiled in the same WinGW version as the it uses itself for developping. Can I download a binary version of it somewhere?

          I found a lot of posts in the net about this subject. It seem that only a hand full of persion on this planet had every succes in compiling the designer in WinQW on Windows. Have I a chance to mange this task in my lifetime ?

          A 1 Reply Last reply 26 Jun 2015, 22:02
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 26 Jun 2015, 21:48 last edited by
            #5

            Qt Creator doesn't need to be compiled with the same compiler nor use the same architecture as the Qt version you are currently using, it's just an IDE. On the other hand creating and validating packages for all supported OS + Architecture combinations (OS X, Linux, Windows (which has 4 different compilers that are not compatible one with another + iOS and Android) is already a huge task that takes much time so that's one of the reasons of optimizing the number of different Qt Creator builds and it's really a Windows specific problem. In any case, you can check the packages here. The Qt Creator provided might be built with the same compiler used to create the packages.

            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
            • A Andy314
              26 Jun 2015, 08:35

              Hello @SGaist !

              Uff, this is a very big pitfall, but explaines much for me.

              The Qt binary package for windows is incompatible with itself!? This decreases my first enthusiasm on Qt very much. What is the idea from Digia behind this concept ???

              How solve other people this problem? Must I develop a plugin in old C++ style (VS10 is used) and develop an other with the same funktionality in MinGW for my running app? Is this possibe?

              The most logic solution would be to get the Designer compiled in the same WinGW version as the it uses itself for developping. Can I download a binary version of it somewhere?

              I found a lot of posts in the net about this subject. It seem that only a hand full of persion on this planet had every succes in compiling the designer in WinQW on Windows. Have I a chance to mange this task in my lifetime ?

              A Offline
              A Offline
              alex_malyu
              wrote on 26 Jun 2015, 22:02 last edited by
              #6

              @Andy314

              The Qt binary package for windows is incompatible with itself!?

              Most of the time no. Very limited number of compilers target binary compatibility.
              The only one I know which does is Intel which is compatible with specific version of Microsoft.
              In any case you do not need to develop separate plugin, but you need to build it with appropriate compiler.
              If you do not want to use Microsoft one you can build Designer with compiler you own.

              Personally I build my own QT binaries.
              It has to be done once per version/ per toolchain and per system (32/64 bit) and guaranties compatibility.
              If you think this is a pain think how much pain would be to build, test and maintain every possible combination.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Andy314
                wrote on 27 Jun 2015, 09:54 last edited by Andy314
                #7

                Ok, I see it is a great chance make my own compile of the Designer. I am not used to make my own IDE, but if it really works it is fine. I will give it a try.
                An other idea, beacause I must not use MinGW. What is with the binary package download for Window with MSVC13 compiler . Is here the Designer compiled with MSVC13 or MSVC11?

                What is in general recommended for Windows developement MinGW or MSVC. What are the disadvantages and advantages of both version?

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on 27 Jun 2015, 13:13 last edited by
                  #8

                  What is in general recommended for Windows developement MinGW or MSVC. What are the disadvantages and advantages of both version?

                  There's no such recommendation. These are both supported and which you use depends on your needs. Which is "better" depends largely on who you ask. Some considerations are as follow:

                  MSVC, as being MS product, has a better platform support and (reported by some people in some cases - yes, this is vague) a better code generation. Depending on what your project is, it will have better (or exclusive) integration with other MS-centric solutions, for example Visual Studio, MFC, .net etc. The debuggers (either built-in VS debugger or CDB) also provide a far better experience.

                  MinGW, as being Windows port of GCC, has a better c++11/14 conformance and is updated more frequently.

                  There are also 3rd party libraries that will support one or the other, or provide binaries for one and only source code for other, so you should check your dependencies when making toolchain decision.

                  1 Reply Last reply
                  0

                  6/8

                  26 Jun 2015, 22:02

                  • Login

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