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:
1>moc_userdetailsgb.cpp
1>.\debug\moc_userdetailsgb.cpp(41) : warning C4273: 'staticMetaObject': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'public: static QMetaObject const UserDetailsGB::staticMetaObject'
1>.\debug\moc_userdetailsgb.cpp(41) : error C2491: 'UserDetailsGB::staticMetaObject': Definition von Statisches Datenmember für dllimport nicht zulässig
1>.\debug\moc_userdetailsgb.cpp(47) : warning C4273: 'UserDetailsGB::metaObject': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'metaObject'
1>.\debug\moc_userdetailsgb.cpp(52) : warning C4273: 'UserDetailsGB::qt_metacast': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacast'
1>.\debug\moc_userdetailsgb.cpp(60) : warning C4273: 'UserDetailsGB::qt_metacall': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacall'
1>Das Buildprotokoll wurde unter "file://d:\Development\Projects\Test_MainWindow\debug\BuildLog.htm" gespeichert.
1>testApp - 1 Fehler, 4 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========
1>moc_userdetailsgb.cpp
1>.\debug\moc_userdetailsgb.cpp(41) : warning C4273: 'staticMetaObject': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'public: static QMetaObject const UserDetailsGB::staticMetaObject'
1>.\debug\moc_userdetailsgb.cpp(41) : error C2491: 'UserDetailsGB::staticMetaObject': Definition von Statisches Datenmember für dllimport nicht zulässig
1>.\debug\moc_userdetailsgb.cpp(47) : warning C4273: 'UserDetailsGB::metaObject': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'metaObject'
1>.\debug\moc_userdetailsgb.cpp(52) : warning C4273: 'UserDetailsGB::qt_metacast': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacast'
1>.\debug\moc_userdetailsgb.cpp(60) : warning C4273: 'UserDetailsGB::qt_metacall': Inkonsistente DLL-Bindung.
1> d:\development\projects\test_mainwindow\debug\../userdetailsgb.h(52): Siehe vorherige Definition von 'qt_metacall'
1>Das Buildprotokoll wurde unter "file://d:\Development\Projects\Test_MainWindow\debug\BuildLog.htm" gespeichert.
1>testApp - 1 Fehler, 4 Warnung(en)
========== 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.
TEMPLATE = vclib
LANGUAGE = C++
TARGET = userdetailsgb
DESTDIR = C:\Qt\4.2.3\plugins\designer
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
CONFIG += designer plugin debug_and_release
DEFINES += USERDETAILSGB_LIB
######################################
# Header files
######################################
HEADERS = ./src/userdetailsgb.h \
./src/userdetailsgbplugin.h \
./src/userdetailsgbpluginglobal.h \
######################################
# Source files
######################################
SOURCES = ./src/userdetailsgb.cpp \
./src/userdetailsgbplugin.cpp
TEMPLATE = vclib
LANGUAGE = C++
TARGET = userdetailsgb
DESTDIR = C:\Qt\4.2.3\plugins\designer
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
CONFIG += designer plugin debug_and_release
DEFINES += USERDETAILSGB_LIB
######################################
# Header files
######################################
HEADERS = ./src/userdetailsgb.h \
./src/userdetailsgbplugin.h \
./src/userdetailsgbpluginglobal.h \
######################################
# Source files
######################################
SOURCES = ./src/userdetailsgb.cpp \
./src/userdetailsgbplugin.cpp
To copy to clipboard, switch view to plain text mode
here the userdetailsgbpluginglobal.h file:
#ifndef USERDETAILSGBPLUGINGLOBAL_H
#define USERDETAILSGBPLUGINGLOBAL_H
#include <Qt/qglobal.h>
#ifdef USERDETAILSGB_LIB
# define USERDETAILSGBPLUGIN_EXPORT Q_DECL_EXPORT
#else
# define USERDETAILSGBPLUGIN_EXPORT Q_DECL_IMPORT
#endif
#endif // USERDETAILSGBPLUGINGLOBAL_H
#ifndef USERDETAILSGBPLUGINGLOBAL_H
#define USERDETAILSGBPLUGINGLOBAL_H
#include <Qt/qglobal.h>
#ifdef USERDETAILSGB_LIB
# define USERDETAILSGBPLUGIN_EXPORT Q_DECL_EXPORT
#else
# define USERDETAILSGBPLUGIN_EXPORT Q_DECL_IMPORT
#endif
#endif // USERDETAILSGBPLUGINGLOBAL_H
To copy to clipboard, switch view to plain text mode
here the userdetailsgbplugin.h file
#ifndef USERDETAILSGBPLUGIN_H
#define USERDETAILSGBPLUGIN_H
#include "userdetailsgbpluginglobal.h"
#include <QObject>
#include <QDesignerCustomWidgetInterface>
{
Q_OBJECT
public:
UserDetailsGBPlugin
( QObject *parent
= 0 );
bool isContainer() const;
bool isInitialized() const;
private:
bool initialized;
};
#endif // USERDETAILSGBPLUGIN_H
#ifndef USERDETAILSGBPLUGIN_H
#define USERDETAILSGBPLUGIN_H
#include "userdetailsgbpluginglobal.h"
#include <QObject>
#include <QDesignerCustomWidgetInterface>
class USERDETAILSGBPLUGIN_EXPORT UserDetailsGBPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES( QDesignerCustomWidgetInterface )
public:
UserDetailsGBPlugin( QObject *parent = 0 );
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget( QWidget *parent );
void initialize( QDesignerFormEditorInterface *core );
private:
bool initialized;
};
#endif // USERDETAILSGBPLUGIN_H
To copy to clipboard, switch view to plain text mode
here the userdetailsgb.h file
#ifndef USERDETAILSGB_H
#define USERDETAILSGB_H
#include <QObject>
#include <QGroupBox>
#include <QtDesigner/QDesignerExportWidget>
class QDESIGNER_WIDGET_EXPORT UserDetailsGB
: public QGroupBox{
Q_OBJECT
public:
UserDetailsGB
( QWidget * parent
= 0 );
~UserDetailsGB() {}
};
#endif // USERDETAILSGB_H
#ifndef USERDETAILSGB_H
#define USERDETAILSGB_H
#include <QObject>
#include <QGroupBox>
#include <QtDesigner/QDesignerExportWidget>
class QDESIGNER_WIDGET_EXPORT UserDetailsGB : public QGroupBox
{
Q_OBJECT
public:
UserDetailsGB( QWidget * parent = 0 );
~UserDetailsGB() {}
};
#endif // USERDETAILSGB_H
To copy to clipboard, switch view to plain text mode
and finally here the main app pro file
TEMPLATE = vcapp
TARGET = testApp
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += testmainwindow.h userdetailsgb.h
FORMS += mainwindow.ui
SOURCES += main.cpp testmainwindow.cpp
TEMPLATE = vcapp
TARGET = testApp
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += testmainwindow.h userdetailsgb.h
FORMS += mainwindow.ui
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
Bookmarks