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. Custom Widgets Plugins: QT_INSTALL_PLUGIN not working on Windows 7 & Bug in Qt 5.6 Custom Widget Interface template
Forum Updated to NodeBB v4.3 + New Features

Custom Widgets Plugins: QT_INSTALL_PLUGIN not working on Windows 7 & Bug in Qt 5.6 Custom Widget Interface template

Scheduled Pinned Locked Moved Unsolved General and Desktop
custom widgetpluginsbugwindows
4 Posts 2 Posters 2.3k 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.
  • G Offline
    G Offline
    ghielmetti
    wrote on 25 May 2016, 11:07 last edited by ghielmetti
    #1

    I am quite new to Qt and I would like to build a Custom Widget Plugin for the Qt-Designer. I am running Qt 5.6 on Windows 7.

    I have tried to follow the examples in the Qt-tutorials and other tutorials, but I cannot get it working yet. It seems as if the libraries that should be generated with the build are not written into the correct target directory, which I have set in the .pro file:

    CONFIG += plugin debug_and_release
    TARGET = $$qtLibraryTarget(levelmeterplugin)
    TEMPLATE = lib

    HEADERS = levelmeterplugin.h
    SOURCES = levelmeterplugin.cpp
    RESOURCES = icons.qrc
    LIBS += -L.

    greaterThan(QT_MAJOR_VERSION, 4) {
    QT += designer
    } else {
    CONFIG += designer
    }

    #target.path = C:/Qt/5.6/mingw49_32/plugins/designer
    #target.path = C:/Users/chd/Documents/Qt_Software/Qt_Designer_Widgets
    target.path = $$[QT_INSTALL_PLUGINS]/designer
    INSTALLS += target

    I have added my custom library directory to the QT_INSTALL_PLUGINS environment viariable and I have also added the path to the plugins directory: C:/Qt/5.6/<compiler_name>/plugins/
    I have also tried to build the libraries without using the QT_INSTALL_PLUGIN directory.

    Although it seems as the environmental variables are set correctly, the libraries get built into the build debug directory of the widget and the widget is not available in Qt-Designer.

    I assume that Qt does not seem to use the target QT_INSTALL_PLUGIN settings, but I am not sure about this.

    Does anyone know what could cause this issue? How can I get Qt to use the QT_INSTALL_PLUGIN environmental variable?

    Any help or a link to a working clear step by step tutorial would be really apprecciated.

    PS: I have also noticed that Qt 5.6 offers a template for the interface for building a Custom Widget Plugin, but building the template interface produces an error on the compiler output due to a wrong include:
    #include <QtDesigner/QDesignerCustomWidgetInterface>

    This can be resolved with replacing this include with:
    #include <QtUiPlugin/QDesignerCustomWidgetInterface>

    I found this a bit confusing, as I actually would expect a template provided by Qt to work by default.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 25 May 2016, 11:43 last edited by
      #2

      @ghielmetti said:

      Hi and welcome

      mingw49_32

      You cannot make plugins for Designer with mingw unless u compile Creator yourself with same compiler.
      Creator is compiled with Visual Studio and you need to use that compiler to create plugins for it.
      (as far as i know) Its not Qt fault. just how DLLS works.

      If you want a plugin just to be able to place it visually, you can do that with the promote feature and
      skip the whole plugin part.
      But if u want to adjust properties design time, then u need plugin.

      G 1 Reply Last reply 25 May 2016, 14:01
      1
      • M mrjj
        25 May 2016, 11:43

        @ghielmetti said:

        Hi and welcome

        mingw49_32

        You cannot make plugins for Designer with mingw unless u compile Creator yourself with same compiler.
        Creator is compiled with Visual Studio and you need to use that compiler to create plugins for it.
        (as far as i know) Its not Qt fault. just how DLLS works.

        If you want a plugin just to be able to place it visually, you can do that with the promote feature and
        skip the whole plugin part.
        But if u want to adjust properties design time, then u need plugin.

        G Offline
        G Offline
        ghielmetti
        wrote on 25 May 2016, 14:01 last edited by
        #3

        @mrjj Thank you for your reply.
        I will compile the plugin with msvc2013 and see if I get it working. I have promoted a widget and this seems to work. However, for some reason sometimes Qt can not find the paths to my promoted widgets' .h and .cpp files that I set in the .pro file. But it works if I copy the files into the project manually.

        M 1 Reply Last reply 25 May 2016, 18:28
        1
        • G ghielmetti
          25 May 2016, 14:01

          @mrjj Thank you for your reply.
          I will compile the plugin with msvc2013 and see if I get it working. I have promoted a widget and this seems to work. However, for some reason sometimes Qt can not find the paths to my promoted widgets' .h and .cpp files that I set in the .pro file. But it works if I copy the files into the project manually.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 25 May 2016, 18:28 last edited by
          #4

          @ghielmetti
          Hi
          Normally I do have the .h file in the project folder and point to that in the
          Promote dialog.
          Im not sure it will take a full path in the dialog but I never tried :)

          1 Reply Last reply
          0

          2/4

          25 May 2016, 11:43

          • Login

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