Results 1 to 5 of 5

Thread: Qt Designer plugin on windows

  1. #1
    Join Date
    Nov 2006
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt Designer plugin on windows

    Hi All,

    I have successful created a Qt Designer plugin (customer groupbox) on linux. This plugin I also can successful use in my main window where I do display some customer information(compile and run without any errors).

    Now I'm switching over to windows and I'm getting my first trouble with it. Creating the dll and the lib files could be done without any problems. But if I use the created plugin in a main window, I get the follwing errors/warnigs:

    Qt Code:
    1. 1>moc_userdetailsgb.cpp
    2. 1>.\debug\moc_userdetailsgb.cpp(41) : warning C4273: 'staticMetaObject': Inkonsistente DLL-Bindung.
    3. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'public: static QMetaObject const UserDetailsGB::staticMetaObject'
    4. 1>.\debug\moc_userdetailsgb.cpp(41) : error C2491: 'UserDetailsGB::staticMetaObject': Definition von Statisches Datenmember für dllimport nicht zulässig
    5. 1>.\debug\moc_userdetailsgb.cpp(47) : warning C4273: 'UserDetailsGB::metaObject': Inkonsistente DLL-Bindung.
    6. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'metaObject'
    7. 1>.\debug\moc_userdetailsgb.cpp(52) : warning C4273: 'UserDetailsGB::qt_metacast': Inkonsistente DLL-Bindung.
    8. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacast'
    9. 1>.\debug\moc_userdetailsgb.cpp(60) : warning C4273: 'UserDetailsGB::qt_metacall': Inkonsistente DLL-Bindung.
    10. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacall'
    11. 1>Das Buildprotokoll wurde unter "file://d:\Development\Projects\Test_MainWindow\debug\BuildLog.htm" gespeichert.
    12. 1>testApp - 1 Fehler, 4 Warnung(en)
    13. ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========
    To copy to clipboard, switch view to plain text mode 

    Here the plugin pro file.
    Qt Code:
    1. TEMPLATE = vclib
    2. LANGUAGE = C++
    3. TARGET = userdetailsgb
    4. DESTDIR = C:\Qt\4.2.3\plugins\designer
    5.  
    6. target.path = $$[QT_INSTALL_PLUGINS]/designer
    7. INSTALLS += target
    8. CONFIG += designer plugin debug_and_release
    9.  
    10. DEFINES += USERDETAILSGB_LIB
    11.  
    12. ######################################
    13. # Header files
    14. ######################################
    15. HEADERS = ./src/userdetailsgb.h \
    16. ./src/userdetailsgbplugin.h \
    17. ./src/userdetailsgbpluginglobal.h \
    18.  
    19.  
    20. ######################################
    21. # Source files
    22. ######################################
    23. SOURCES = ./src/userdetailsgb.cpp \
    24. ./src/userdetailsgbplugin.cpp
    To copy to clipboard, switch view to plain text mode 

    here the userdetailsgbpluginglobal.h file:
    Qt Code:
    1. #ifndef USERDETAILSGBPLUGINGLOBAL_H
    2. #define USERDETAILSGBPLUGINGLOBAL_H
    3.  
    4. #include <Qt/qglobal.h>
    5.  
    6. #ifdef USERDETAILSGB_LIB
    7. # define USERDETAILSGBPLUGIN_EXPORT Q_DECL_EXPORT
    8. #else
    9. # define USERDETAILSGBPLUGIN_EXPORT Q_DECL_IMPORT
    10. #endif
    11.  
    12. #endif // USERDETAILSGBPLUGINGLOBAL_H
    To copy to clipboard, switch view to plain text mode 

    here the userdetailsgbplugin.h file
    Qt Code:
    1. #ifndef USERDETAILSGBPLUGIN_H
    2. #define USERDETAILSGBPLUGIN_H
    3.  
    4. #include "userdetailsgbpluginglobal.h"
    5.  
    6. #include <QObject>
    7. #include <QDesignerCustomWidgetInterface>
    8.  
    9. class USERDETAILSGBPLUGIN_EXPORT UserDetailsGBPlugin : public QObject, public QDesignerCustomWidgetInterface
    10. {
    11. Q_OBJECT
    12.  
    13. public:
    14. UserDetailsGBPlugin( QObject *parent = 0 );
    15.  
    16. bool isContainer() const;
    17. bool isInitialized() const;
    18. QIcon icon() const;
    19. QString domXml() const;
    20. QString group() const;
    21. QString includeFile() const;
    22. QString name() const;
    23. QString toolTip() const;
    24. QString whatsThis() const;
    25. QWidget *createWidget( QWidget *parent );
    26. void initialize( QDesignerFormEditorInterface *core );
    27.  
    28. private:
    29. bool initialized;
    30. };
    31.  
    32. #endif // USERDETAILSGBPLUGIN_H
    To copy to clipboard, switch view to plain text mode 

    here the userdetailsgb.h file
    Qt Code:
    1. #ifndef USERDETAILSGB_H
    2. #define USERDETAILSGB_H
    3.  
    4. #include <QObject>
    5. #include <QGroupBox>
    6. #include <QtDesigner/QDesignerExportWidget>
    7.  
    8. class QDESIGNER_WIDGET_EXPORT UserDetailsGB : public QGroupBox
    9. {
    10. Q_OBJECT
    11.  
    12. public:
    13. UserDetailsGB( QWidget * parent = 0 );
    14. ~UserDetailsGB() {}
    15.  
    16. };
    17.  
    18. #endif // USERDETAILSGB_H
    To copy to clipboard, switch view to plain text mode 

    and finally here the main app pro file
    Qt Code:
    1. TEMPLATE = vcapp
    2. TARGET = testApp
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5.  
    6. # Input
    7. HEADERS += testmainwindow.h userdetailsgb.h
    8. FORMS += mainwindow.ui
    9. SOURCES += main.cpp testmainwindow.cpp
    To copy to clipboard, switch view to plain text mode 

    I'm using MSVC 2005 Express, Windows XP, Qt 4.2.3.
    Any help on this would be great. Many thanks.
    big4mil

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer plugin on windows

    Are you sure this is the first error?
    Did you add Q_EXPORT_PLUGIN2(customwidgetplugin, MyCustomWidget) at the bottom of userdetailsgbpluginglobal.cpp?
    Last edited by high_flyer; 29th May 2007 at 23:46.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2006
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer plugin on windows

    Hi,

    thanks for your reply!

    Yes, it is the first error. Below you can see the whole compiler output:
    Qt Code:
    1. 1>------ Neues Erstellen gestartet: Projekt: testApp, Konfiguration: Debug Win32 ------
    2. 1>Die Zwischen- und Ausgabedateien für das Projekt "testApp" mit der Konfiguration "Debug|Win32" werden gelöscht.
    3. 1>MOC userdetailsgb.h
    4. 1>UIC mainwindow.ui
    5. 1>MOC testmainwindow.h
    6. 1>Kompilieren...
    7. 1>main.cpp
    8. 1>testmainwindow.cpp
    9. 1>moc_testmainwindow.cpp
    10. 1>moc_userdetailsgb.cpp
    11. 1>.\debug\moc_userdetailsgb.cpp(41) : warning C4273: 'staticMetaObject': Inkonsistente DLL-Bindung.
    12. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'public: static QMetaObject const UserDetailsGB::staticMetaObject'
    13. 1>.\debug\moc_userdetailsgb.cpp(41) : error C2491: 'UserDetailsGB::staticMetaObject': Definition von Statisches Datenmember für dllimport nicht zulässig
    14. 1>.\debug\moc_userdetailsgb.cpp(47) : warning C4273: 'UserDetailsGB::metaObject': Inkonsistente DLL-Bindung.
    15. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'metaObject'
    16. 1>.\debug\moc_userdetailsgb.cpp(52) : warning C4273: 'UserDetailsGB::qt_metacast': Inkonsistente DLL-Bindung.
    17. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacast'
    18. 1>.\debug\moc_userdetailsgb.cpp(60) : warning C4273: 'UserDetailsGB::qt_metacall': Inkonsistente DLL-Bindung.
    19. 1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacall'
    20. 1>Code wird generiert...
    21. 1>Das Buildprotokoll wurde unter "file://d:\Development\Projects\Test_MainWindow\debug\BuildLog.htm" gespeichert.
    22. 1>testApp - 1 Fehler, 4 Warnung(en)
    23. ========== Alles neu erstellen: 0 erfolgreich, Fehler bei 1, 0 übersprungen ==========
    To copy to clipboard, switch view to plain text mode 

    Did you add Q_EXPORT_PLUGIN2(customwidgetplugin, MyCustomWidget) at the bottom of userdetailsgbpluginglobal.cpp?
    I have included this Qt macro in my userdetailsgbplugin.cpp file and NOT in the userdetailsgbpluginglobal.cpp file (which I actually do not have, the userdetailsgbpluginglobal.h file is just a header file where I do declare my #defines, nothing else.)

    Any other ideas?

    Many thanks!

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer plugin on windows

    I don't think this will solve the problem, but you must add thead support in CONFIG in the pro file.
    Oh, and try a release version.
    Last edited by high_flyer; 30th May 2007 at 09:12.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Nov 2006
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Designer plugin on windows

    Quote Originally Posted by high_flyer View Post
    I don't think this will solve the problem, but you must add thead support in CONFIG in the pro file.
    Oh, and try a release version.
    this does not help. I still get the same errors.

    I have attached two projects. userdetailsgb will create the qt designer plugin and the test_mainwindow project will use the plugin on a simple main window. So please, if you have time to make a quick test on your system, that would be great.
    (MSVC 2005 Express, Windows XP, Qt 4.2.3)

    Many thanks for your help.
    Best regards
    big4mil
    Attached Files Attached Files
    Last edited by big4mil; 30th May 2007 at 21:59.

Similar Threads

  1. Replies: 1
    Last Post: 22nd January 2007, 12:13
  2. Replies: 13
    Last Post: 15th December 2006, 11:52
  3. Replies: 5
    Last Post: 23rd May 2006, 11:40
  4. Application plugin on windows
    By Eyee in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2006, 17:36
  5. Size of a plugin widget in designer
    By high_flyer in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2006, 13:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.