标签:pwd .dll 自定义控件 target template get eve plugin 自定义
一,首先新建一个功能,例如:spprogressbar
spprogressbar.pro
CONFIG += plugin debug_and_release TARGET = $$qtLibraryTarget(spprogressbarplugin) TEMPLATE = lib DESTDIR = $$PWD/../lib HEADER_PATH = $$PWD/../../include SOURCE_PATH = $$PWD/../../src HEADERS += $$PWD/spprogressbar.h SOURCES += $$PWD/spprogressbar.cpp LIBS += -L. greaterThan(QT_MAJOR_VERSION, 4) { QT += designer } else { CONFIG += designer } target.path = $$[QT_INSTALL_PLUGINS]/designer INSTALLS += target INCLUDEPATH += $$HEADER_PATH/
spprogressbar.h
#ifndef SPPROGRESSBAR_H #define SPPROGRESSBAR_H #include <QWidget> #include <QPainter> #include <QMouseEvent> class SpProgressBar : public QWidget { Q_OBJECT public: SpProgressBar(QWidget *parent = 0); }; #endif
spprogressbar.cpp
#include "spprogressbar.h" SpProgressBar::SpProgressBar(QWidget *parent) : QWidget(parent) { }
二,然后将编译生成的dll文件libspprogressbarplugin.dll放到Qt\Qt5.9.1\mingw53_32\plugins\designer下
三,重启designer就可以看到自动以的控件了
标签:pwd .dll 自定义控件 target template get eve plugin 自定义
原文地址:https://www.cnblogs.com/senior-engineer/p/9603867.html