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:

Qt Designer plugin 探秘


Select the Director to save the Project and named the Project:


Qt Designer plugin 探秘


Create the class to implement the custom widget:


Qt Designer plugin 探秘


Named your plugin:


Qt Designer plugin 探秘


To click the Finish Button, we can see the construct of the project directory as follow:


Qt Designer plugin 探秘


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.

Qt Designer plugin 探秘Qt Designer plugin 探秘


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