DAWorkbench
0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DACommonPropertySettingDialog.h
1
#ifndef DACOMMONPROPERTYSETTINGDIALOG_H
2
#define DACOMMONPROPERTYSETTINGDIALOG_H
3
4
#include <QDialog>
5
#include <QJsonObject>
6
#include "DACommonWidgetsAPI.h"
7
8
namespace
Ui
9
{
10
class
DACommonPropertySettingDialog;
11
}
12
13
class
QtProperty;
14
namespace
DA
15
{
257
class
DACOMMONWIDGETS_API
DACommonPropertySettingDialog
:
public
QDialog
258
{
259
Q_OBJECT
260
DA_DECLARE_PRIVATE(
DACommonPropertySettingDialog
)
261
public
:
262
explicit
DACommonPropertySettingDialog
(QWidget* parent =
nullptr
);
263
~DACommonPropertySettingDialog
();
264
265
// 从 JSON 字符串加载配置
266
bool
loadFromJson(
const
QString& jsonStr);
267
268
// 从 QJsonObject 加载配置
269
bool
loadFromJsonObject(
const
QJsonObject& jsonObj);
270
271
// 获取所有属性的当前值
272
QJsonObject getCurrentValues()
const
;
273
274
// 获取特定属性的当前值
275
QVariant getValue(
const
QString& propertyName)
const
;
276
277
// 设置特定属性的值
278
bool
setValue(
const
QString& propertyName,
const
QVariant& value);
279
280
// 静态方法:显示设置对话框并获取结果
281
static
QJsonObject showSettingsDialog(
const
QString& jsonConfig, QWidget* parent =
nullptr
);
282
283
// 重置所有属性为默认值
284
void
resetToDefaults();
285
286
protected
:
292
void
changeEvent(QEvent* e)
override
;
293
294
Q_SIGNALS:
307
void
propertyValueChanged
(
const
QString& propertyName,
const
QVariant& value);
308
309
private
Q_SLOTS:
310
311
void
onPropertyValueChanged(QtProperty* property,
const
QVariant& value);
312
313
private
:
314
Ui::DACommonPropertySettingDialog* ui;
315
};
316
}
// end namespace DA
317
#endif
// DACOMMONPROPERTYSETTINGDIALOG_H
DA::DACommonPropertySettingDialog
通用的属性设置对话框,支持通过 JSON 配置动态生成设置界面
Definition
DACommonPropertySettingDialog.h:258
DA::DACommonPropertySettingDialog::propertyValueChanged
void propertyValueChanged(const QString &propertyName, const QVariant &value)
属性值变更信号
DA
序列化类都是带异常的,使用中需要处理异常
Definition
AppMainWindow.cpp:44
src
DACommonWidgets
DACommonPropertySettingDialog.h
制作者
1.9.8