确保qt5 安装的时候选择了script组件
把QtnProperty-master放入项目文件夹
在项目的.pro文件中加入
include(QtnProperty
-master\QtnProperty
.pri
)
修改ui_mainwindow.h
#include <PropertyWidget/PropertyWidget.h>
....
centralWidget
= new QtnPropertyWidget(MainWindow
);
修改mainwindow.cpp
#include "Core/PropertyCore.h"
#include "Core/GUI/PropertyQColor.h"
......
auto m_propertySet
= new QtnPropertySet(this);
auto floatValue
= qtnCreateProperty
<QtnPropertyFloat
>(m_propertySet
);
floatValue
->setName(tr("Value"));
floatValue
->setDescription(tr("Float value"));
floatValue
->setMaxValue(1.f);
floatValue
->setMinValue(0.f);
floatValue
->setStepValue(0.1f);
floatValue
->setValue(0.3f);
auto textColor
= qtnCreateProperty
<QtnPropertyQColor
>(m_propertySet
);
textColor
->setName(tr("TextColor"));
textColor
->setDescription(tr("Foreground text color"));
textColor
->setValue(QColor(0, 0, 0));
ui
->centralWidget
->setPropertySet(m_propertySet
);
效果
转载请注明原文地址:https://ipadbbs.8miu.com/read-13049.html