Qt Designer plugin 探秘
Required Environment:
Qt-5.7.1- msvc2015,Qt Creator-4.2.0
First Step:
Open the Creator,File->New File or Project;Configure the Dialog as Follow:
Select the Director to save the Project and named the Project:
Create the class to implement the custom widget:
Named your plugin:
To click the Finish Button, we can see the construct of the project directory as follow:
We should make some changes with the File ts.pri and ts.h:
1.add the line QT += uiplugin with the file ts.pri. And include the QtUiPlugin/QDesignerExportWidget file and add the marco QDESIGNER_WIDGET_EXPORT to the class ts.
the marco QDESIGNER_WIDGET_EXPORT make us use the LIB of the plugin to do the secondary development, otherwise it can generate the link error: unresolved external symbol!
Reference:Qt Offical Examples: Custom Plugin for Qt Designer