So I added the export and includes QDesignerExportWidget to my class and now it 
wont compile -

Moc'ing MyLabel.h...
1>  moc_MyLabel.cpp
1>Build\moc\moc_MyLabel.cpp(55): warning C4273: 'MyLabel::qt_static_metacall' : 
inconsistent dll linkage
1>          c:\sandbox\testplugin\widgets\build\moc\../../MyLabel.h(10) : see 
previous definition of 'qt_static_metacall'
1>Build\moc\moc_MyLabel.cpp(62): warning C4273: 'staticMetaObject' : 
inconsistent dll linkage
1>          c:\sandbox\testplugin\widgets\build\moc\../../MyLabel.h(10) : see 
previous definition of 'public: static QMetaObject const 
MyLabel::staticMetaObject'
1>Build\moc\moc_MyLabel.cpp(62): error C2491: 'MyLabel::staticMetaObject' : 
definition of dllimport static data member not allowed
1>Build\
.................

I have no idea why
From: Harish Surana [mailto:suran...@gmail.com]
Sent: 03 December 2013 11:13
To: Graham Labdon
Cc: interest@qt-project.org
Subject: Re: [Interest] using designer plugin in application

If you look for QDESIGNER_WIDGET_EXPORT in the documentation. You will get:

QDESIGNER_WIDGET_EXPORT

This macro is used when defining custom widgets to ensure that they are 
correctly exported from plugins for use with Qt Designer.

On some platforms, the symbols required by Qt Designer to create new widgets 
are removed from plugins by the build system, making them unusable. Using this 
macro ensures that the symbols are retained on those platforms, and has no side 
effects on other platforms.

For example, the World Time Clock 
Plugin<qthelp://com.trolltech.qt.484/qdoc/designer-worldtimeclockplugin.html> 
example exports a custom widget class with the following declaration:



 class QDESIGNER_WIDGET_EXPORT WorldTimeClock : public 
QWidget<qthelp://com.trolltech.qt.484/qdoc/qwidget.html>

 {

     Q_OBJECT

     ...

 };


On Tue, Dec 3, 2013 at 12:00 PM, Graham Labdon 
<graham.lab...@avalonsciences.com<mailto:graham.lab...@avalonsciences.com>> 
wrote:
Hi
I have read this but cannot get it to work (I am using Qt5.1.1 with Visual 
Studio
I have a library called Widgets.dll that contains 1 class declared as
#include <QLabel>
#include "widgets_global.h"

class WIDGETS_EXPORT MyLabel : public QLabel
{
               Q_OBJECT

public:
               MyLabel(QWidget *parent);
               ~MyLabel();

private:

};
I have set up my plugin project so that it can see the header file for MyLabel 
and can see the Widgets.lib
The plugin project builds without error but is not visible in Designer
Can anyone see the reason for this?

Thanks

From: Harish Surana [mailto:suran...@gmail.com<mailto:suran...@gmail.com>]
Sent: 03 December 2013 10:20
To: Graham Labdon
Cc: interest@qt-project.org<mailto:interest@qt-project.org>
Subject: Re: [Interest] using designer plugin in application

Yes it is technically possible to make the widgets accessible to Qt Designer 
without linking widgets dll against QtDesigner4.dll. Some possible approaches 
are described here: 
http://qt-project.org/doc/qt-4.8/designer-creating-custom-widgets.html (see the 
section "Splitting up the Plugin").

On Tue, Dec 3, 2013 at 10:31 AM, Graham Labdon 
<graham.lab...@avalonsciences.com<mailto:graham.lab...@avalonsciences.com>> 
wrote:
Hi
I have developed a number of Qt Designer plugins and can use them in my 
applications.
But obviously I need my apps to link against the plugin library which means 
when I deploy the application I need to deploy the plugin library as well.
What I would like is for widget classes to be compiled into one library that 
both the application and the designer plugin can use but I have been unable to 
achieve this.
Is this possible?



_______________________________________________
Interest mailing list
Interest@qt-project.org<mailto:Interest@qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to