环境:QT6.5, VS2022, QT Visual Studio Tool 2.10.1
1. QT Custom Designer Widget 无法显示到WidgetBox中的解决方案:
-
- QDESIGNER_WIDGET_EXPORT
- 需要将生成的dll和lib放置到目录D:\Qt\6.5.1\msvc2019_64\plugins\designer下,重启QT即可。
#include <QtWidgets/QWidget> #include <QtUiPlugin/QDesignerExportWidget> class QDESIGNER_WIDGET_EXPORT CustomControls : public QWidget { Q_OBJECT public: CustomControls(QWidget *parent = nullptr); };
2. 添加样式文件
QtWidgetsApplication2::QtWidgetsApplication2(QWidget *parent) : QMainWindow(parent) { QFile file("darkstyle.qss"); file.open(QIODevice::ReadOnly); setStyleSheet(file.readAll()); ui.setupUi(this); }
标签:file,QT,parent,Error,EXPORT,QWidget,QDESIGNER From: https://www.cnblogs.com/xiaoyinxxy/p/17468725.html