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. Can't install custom widget
QtWS25 Last Chance

Can't install custom widget

Scheduled Pinned Locked Moved General and Desktop
14 Posts 2 Posters 3.8k 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.
  • M Offline
    M Offline
    mrcgnerd
    wrote on last edited by
    #1

    Hello I am trying to install custom widget QSlide: "LINK":http://qt-apps.org/content/show.php/QSlide?content=75303

    But I can't compile it, getting error:
    "invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure<false>'
    enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, COUNTER) = sizeof(QStaticAssertFailure<!!(Condition)>)}"

    Cand find out how to fix it ?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      It seems it's a plugin for Qt 4 and you're using Qt5, where the macro Q_EXPORT_PLUGIN2 is no longer used.
      See "this":http://qt-project.org/doc/qt-5/plugins-howto.html for some info on plugins in Qt5

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrcgnerd
        wrote on last edited by
        #3

        Thanks. So I should use Q_PLUGIN_METADATA instead.

        In examle it looks like this:
        Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE mystyleplugin.json)

        I dont understund what is this: "org.qt-project.Qt.QStyleFactoryInterface"
        What path should I add in this place ?

        And what data should I add in .json file ?
        If I understund corectly it should be like this:

        Old code:
        @Q_EXPORT_PLUGIN2(customwidgetplugin, QSlidePlugin) // DELETE IT@

        Then create file "myqslider.json" and add following content :

        @{ "Keys": [ "customwidgetplugin", QSlidePlugin ] }@

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The "doc":http://qt-project.org/doc/qt-5.0/qtcore/qtplugin.html#Q_PLUGIN_METADATA says it's the interface the plugin implements.
          QSlide implements QDesignerCustomWidgetInterface so I would guess it's something like "org.qt-project.Qt.QDesignerCustomWidgetInterface" but I've never created any plugins so I might be wrong ;)

          [Edit] Yup, this "example":http://qt-project.org/doc/qt-5/qdesignercustomwidgetinterface.html#details seems to confirm this.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mrcgnerd
            wrote on last edited by
            #5

            Ok I will try, thank you.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrcgnerd
              wrote on last edited by
              #6

              Ok, now when I compile plugin window opens:

              "could not find the executable, please specify one".

              There is "qslideplugd.dll" in debug directory maybe I should place it in Qt somewhere, to make widget appear in Designer.
              I tried C:\Qt\Qt5.2.1\5.2.1\mingw48_32\plugins\designer but no luck.

              1 Reply Last reply
              0
              • Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #7

                “could not find the executable, please specify one” - this is not when you compile but when you try to run it. Plugin is a library (a dll) so there's nothing to run.

                The directory you pasted is the directory of Qt (the library).
                You need to place it in the plugins directory of the Qt Creator (the IDE).

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mrcgnerd
                  wrote on last edited by
                  #8

                  OK Thank you for help. I think i will live without plugins for now...

                  I can't get it working, it wont load in Designer.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mrcgnerd
                    wrote on last edited by
                    #9

                    I checked in plugin information window, and it seams that .dll is in corect place, but it can't be loaded, it shows following mesage:

                    "Cannot load library C:\Qt\Qt5.2.1\Tools\QtCreator\bin\plugins\designer the specified module could not be found"

                    1 Reply Last reply
                    0
                    • Chris KawaC Offline
                      Chris KawaC Offline
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Plugins need to be built with the same compiler and Qt version (or at least binary compatible one) that was used to build Qt Creator (you can check in about window what was used for Creator). For example creator bundled with the online installer was built with 32bit VS2010.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mrcgnerd
                        wrote on last edited by
                        #11

                        But just rebuilded plugin using my current Qt version, I dont understand. I have to build plugin using VS ?

                        1 Reply Last reply
                        0
                        • Chris KawaC Offline
                          Chris KawaC Offline
                          Chris Kawa
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Ok, let's break it down. These are the things you deal with:

                          • Qt Creator - an IDE that you (probably) installed. To create it a compiler and some Qt version was used. In case of Creator 3.0.1 from online installer it was Qt 5.2.1 compiled with VS2010
                          • Your own program - using whatever Qt and compiler you chose, for example this can be Qt 5.2.1 and MinGW 4.8.
                          • QSlide class - you just include it in your project so it's the same as your program.
                          • QSlide plugin for the Qt Creator - this needs to use the same Qt and compiler version that was used for the Qt Creator

                          So again - to just use the class in your code you can use whatever Qt and compiler you want. You don't need the plugin at all for that.
                          To use the Qt Creator designer plugin both your Qt Creator and the plugin need to use the same Qt and compiler version.

                          If you decide to build the plugin with VS2010 you don't have to use VS(the IDE). Just the compiler from it is needed and you can set it up in the Qt Creator.

                          I hope this is clearer.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mrcgnerd
                            wrote on last edited by
                            #13

                            Thank you for explanation.

                            So I have two options:

                            1. recompile Qt Creator with MinGW (Actualy I don't even know how to do that) or download and reinstall MinGW version.
                            2. rebuild QSlide plugin using VS2010.

                            I think I will try second option, but can I use both MinGW and VS2010, or I have to uninstall MinGW and then install VS2010 ?

                            Sory for stupid questions, My knowledge is basic, I newr tried to use any plugins before.

                            1 Reply Last reply
                            0
                            • Chris KawaC Offline
                              Chris KawaC Offline
                              Chris Kawa
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Ad. 1 Qt-Project doesn't provide Qt-Creator compiled with MinGW. You would have to build it yourself or look for a 3rd party precompiled package. Anyway I wouldn't recommend it.

                              As for the multiple compilers and IDEs - yes, you can have as many of them as you like installed. They don't know about each other. You just set those up as separate toolchain kits in the Creator.

                              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