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. Extend Qlable Widget and add it to the QDesigner Widgetlist
Forum Updated to NodeBB v4.3 + New Features

Extend Qlable Widget and add it to the QDesigner Widgetlist

Scheduled Pinned Locked Moved General and Desktop
25 Posts 5 Posters 7.8k 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.
  • M Offline
    M Offline
    M001
    wrote on last edited by
    #1

    Hallo, I'm trying to subclass QLable and add some functionality to the new class. This works well, but now I want my new Widget to show up in the QT Designer. Im using QT5 and read some Tutorials for creating Plugins, but I didn't understand all off that. is there a simple solution for my problem.
    Thank you very much for your help

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      [quote author="M001" date="1375813969"]Im using QT5 and read some Tutorials for creating Plugins, but I didn’t understand all off that. is there a simple solution for my problem.[/quote]
      :)

      What have you done so far? What is exactly not working? Did you read "this":http://qt-project.org/doc/qt-5.0/qtdesigner/customwidgetplugin.html tutorial? It should be actually really straight forward...
      But there are some pitfalls when creating plugins which lead to fail "silently":http://canvoki.net/Codders/qtpluginnotloading.html when they are loaded.

      But this is all guessing, since you were very vague with the description about your problem...

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

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

        hey :), I also tryed the "Custom Widget Plugin Example" that you mentioned. I copied all the Files from the Website to my computer and open them with QT5.1 and press compile (release). I get the customwidgetplugin.dll and copied it to the plugin directory C:\Qt\Qt5.1.0\5.1.0\mingw48_32\plugins\designer. Then I restart QT, but the Plugin wasn't added, and when I open *Tools>Formulareditor>about QT Designer Plugins * it's also not there. I thougt if i copy a codeexample from qt-project website it should work :), but it dosend. So I think there where no missspelling and theses kinds of errors. There must be another error.
        I am using:
        Qt Creator 2.7.2
        Based on Qt 5.1.0 (32 bit)
        Created on Jul 2 2013 um 20:48:03
        Revision ea5aa79dca

        on a 64bit Windows 7 installation

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          did you look into the second link in my post?

          Qt plugin system has a version check built in.
          My guess: Since you built your plugin with Qt 5.1 it can only be loaded by applications also built with Qt 5.1 (or higher).
          But if the application is built with Qt 5.1.x and the plugin with Qt 5.0.x it should work AFAIK. (backward compatibility)

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

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

            I compiled the plugin with my QT5.1 installation and want to uses the plugin in the same QT5.1 installation. I thougt this should be working.

            1 Reply Last reply
            0
            • raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              QtDesigner needs to be compiled with the same Qt version number (or higher). If it is, there must be another problem.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0
              • M Offline
                M Offline
                M001
                wrote on last edited by
                #7

                okay thanks :), I have checkt the Versions of Creator and designer and they all are based on QT5.1. So when I checkt the Version number ob QTDesigner I opend it from the Startmenu and not via QTCreator and the analogclock plugin is in the Widgetbox and I could use ist in my main window :D. But here is my next question, are the QTDesigner opend from QTCreator and the QTDesigner opend from Startmenue two different Programms, with two different plugin directorys or why I can't find my plugin in one of them but not in the other? Tank you very much for your Help raven-worx :)

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

                  There are two differnt folders. I copied it in the folder for the creator C:\Qt\Qt5.1.0\Tools\QtCreator\bin\plugins\designer. And now the plugin is showing up, but there is an error message:
                  ... .dll coulnd't be load. The procedure could not be found
                  why do I get this error in Creator, when I don't get this error with the same File in QTDesigner?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    I think you are hit by the problem described "here":http://qt-project.org/doc/qtcreator-2.8/adding-plugins.html#matching-build-keys

                    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
                    • M Offline
                      M Offline
                      M001
                      wrote on last edited by
                      #10

                      i downloaded "Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)" it is compiled with MinGW 4.8. Thats the version I currently use, it was installed by the setup. I'm using:
                      Qt Creator 2.7.2
                      Based on Qt 5.1.0 (32 bit)
                      Created on Jul 2 2013 um 20:48:03
                      Revision ea5aa79dca

                      I saw that there is a new QTCreator Version avaliabel "Qt Creator 2.8.0 for Windows (52 MB) ". But how do i find the information with wich version of MinGW it is compiled?

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

                        so, i have installed "qt-windows-opensource-5.0.2-mingw47_32-x86-offline.exe" and copied the Plugin created with “Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)” into the plugin folder of QT5.0.2 QT Creator. Now I get anothe error message when I open the "About QT Creator Plugins" Dialog: ... .dll uses an incompatible QT-libary. (5.1.0) [release]. I found a link where this problem is described: "http://harmattan-dev.nokia.com/docs/library/html/qt4/deployment-plugins.html":http://harmattan-dev.nokia.com/docs/library/html/qt4/deployment-plugins.html . I can't use the Plugin created with 5.1 in 5.0 thats okay, but using the pluigin created with 5.1 in QT5.1 should be okay, but it doesn't work. I don't know what's going on here :(

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          From the link I posted, QtCreator from the SDK is built with MSVC so you need to recompile QtCreator to use your plugin or use the MSVC build (then you would need to install Visual Studio)

                          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
                          • M Offline
                            M Offline
                            M001
                            wrote on last edited by
                            #13

                            another step forward :), Thanks SGaist!
                            I downloaded "Qt 5.1.0 for Windows 32-bit (VS 2012, 511 MB)" compiled the Plugin with this Version and copied the .dll to the "Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)" installation Plugin folder and now I could use this Plugin in my "Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)" installation. That means i see ist in QTCreator-Designer and could move it on my mainwindow. But when i try to compile my project I get these errors:

                            C:\Users\name\build-TestPlugIns-Desktop_Qt_5_1_0_MinGW_32bit-Debug\ui_mainwindow.h:18: Fehler:analogclock.h: No such file or directory

                            the headerfile is missing. I thougt this information is all built in the .dll file?

                            Edit: I am using MS Visual Studio 2012

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              The header is needed to write your code like for any other library

                              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
                              • M Offline
                                M Offline
                                M001
                                wrote on last edited by
                                #15

                                sorry for this stupid question, but what should i write into the headerfile?

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  It's the header file of your widget from the plugin

                                  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
                                  • raven-worxR Offline
                                    raven-worxR Offline
                                    raven-worx
                                    Moderators
                                    wrote on last edited by
                                    #17

                                    [quote author="M001" date="1375882194"]I thougt this information is all built in the .dll file?[/quote]
                                    It is but only the implementation. To use it you need the header file just for the compiler to know which interface to use. The linker then looks for the implementation either in your binary or like in your case in the plugin (dependency).

                                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                                    If you have a question please use the forum so others can benefit from the solution in the future

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      M001
                                      wrote on last edited by
                                      #18

                                      okay i include the headerfile and get many errors:

                                      ...ui_widget.h:56: Fehler:undefined reference to `_imp___ZN11AnalogClockC1EP7QWidget'...moc_analogclock.cpp:70:

                                      ...moc_analogclock.cpp:70: Fehler:undefined reference to `_imp___ZN11AnalogClock16staticMetaObjectE'

                                      ...moc_analogclock.cpp:65: Fehler:undefined reference to `_imp___ZN11AnalogClock16staticMetaObjectE'

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        M001
                                        wrote on last edited by
                                        #19

                                        a little bit more information:

                                        the first error is caused by here:

                                        file: ui_widget.h
                                        @
                                        ....
                                        class Ui_Widget
                                        {
                                        public:
                                        AnalogClock *analogClock;

                                        void setupUi(QWidget *Widget)
                                        {
                                            if (Widget->objectName().isEmpty())
                                                Widget->setObjectName(QStringLiteral("Widget"));
                                            Widget->resize(400, 300);
                                            analogClock = new AnalogClock(Widget); //this line produces the error
                                            analogClock->setObjectName(QStringLiteral("analogClock"));
                                            analogClock->setGeometry(QRect(60, 60, 199, 151));
                                        
                                            retranslateUi(Widget);
                                        
                                            QMetaObject::connectSlotsByName(Widget);
                                        } // setupUi
                                        
                                        void retranslateUi(QWidget *Widget)
                                        {
                                            Widget->setWindowTitle(QApplication::translate("Widget", "Widget", 0));
                                        

                                        #ifndef QT_NO_TOOLTIP
                                        analogClock->setToolTip(QApplication::translate("Widget", "The current time", 0));
                                        #endif // QT_NO_TOOLTIP
                                        #ifndef QT_NO_WHATSTHIS
                                        analogClock->setWhatsThis(QApplication::translate("Widget", "The analog clock widget displays the current time.", 0));
                                        #endif // QT_NO_WHATSTHIS
                                        } // retranslateUi

                                        };
                                        ....
                                        @

                                        second error:

                                        file: moc_analogclock.cpp

                                        @
                                        ....
                                        const QMetaObject *AnalogClock::metaObject() const
                                        {
                                        return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
                                        }
                                        ....@

                                        third
                                        file: --moc_analogclock.cpp

                                        @...
                                        const QMetaObject AnalogClock::staticMetaObject = {
                                        { &QWidget::staticMetaObject, qt_meta_stringdata_AnalogClock.data,
                                        qt_meta_data_AnalogClock, qt_static_metacall, 0, 0}
                                        };--
                                        ....
                                        @

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          M001
                                          wrote on last edited by
                                          #20

                                          if I add analogclock.h and analogclock.cpp files the code compiles and I could use my plugin. but i thougt the analogclock.cpp should be inside the .dll file. Why do I have to add the analogclock.cpp file?

                                          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