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

Extend Qlable Widget and add it to the QDesigner Widgetlist

Scheduled Pinned Locked Moved General and Desktop
25 Posts 5 Posters 8.2k 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
    #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
              • T Offline
                T Offline
                tanmay2227
                wrote on last edited by
                #21

                did you progress any further on this topic i am stuck at the same spot as you were then please help if you found a solution

                Tanmay Priyadarshi

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  NicuPopescu
                  wrote on last edited by
                  #22

                  how this stuffs work:

                  1. custom plugin dll in i.e. ..\qtcreator-2.8.0\bin\plugins\designer\ is loaded by the QtCreator and it needs no header file or other information

                    the plugin's interface provides an includeFile() by which the designer knows what header has to include in ui header file generated for your project

                  2. what follows is just an exemplification:

                  • copy customwidgetplugin.dll and customwidgetplugin.lib to i.e ...\Qt\4.8.5\plugins\designer\

                  • add the header file of your custom widget i.e. analogclock.h in your application dir in order to be found at compilation from ui header file

                  -in pro file add the export library file .lib,

                  i.e.

                  LIBS += $$(QTDIR)\plugins\designer\customwidgetplugin.lib

                  I have tested and works

                  Cheers!

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tanmay2227
                    wrote on last edited by
                    #23

                    but mine is still not working i have added the library but whenever i run after adding the library the application starts and terminates unexpectedly without showing any error

                    Tanmay Priyadarshi

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      NicuPopescu
                      wrote on last edited by
                      #24

                      hehe ... you mix debug and release app and plugin dll, or conversely

                      try to compile both for release or debug

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tanmay2227
                        wrote on last edited by
                        #25

                        i have only used release files do i need to use debug files as well somewhere

                        Tanmay Priyadarshi

                        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