-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsettingseditor.h
58 lines (39 loc) · 1.5 KB
/
settingseditor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef TVSEG_UI_SETTINGSEDITOR_H
#define TVSEG_UI_SETTINGSEDITOR_H
#include <tvseg/settings/settings.h>
#include <QWidget>
#include <QMap>
#include <QtVariantPropertyManager>
#include <QtTreePropertyBrowser>
namespace tvseg_ui {
class SettingsEditor : public QWidget
{
Q_OBJECT
public: // types
typedef tvseg::settings::Settings Settings;
typedef tvseg::settings::EntryPtr EntryPtr;
typedef tvseg::settings::Settings::entry_map_type entry_map_type;
public:
explicit SettingsEditor(QWidget *parent = 0);
QVector<QtProperty*> addEntries(const Settings &s) {
// TODO: handle children and/or maybe parse prefix and names for subgrouping
return addEntries(s.entries(), s.prefix());
}
/// Returns vector of added property objects (without the toplevel item); Can be used to identify properties in the updateEntry signal
QVector<QtProperty*> addEntries(const entry_map_type &s, const std::string &groupName = "Settings");
void clear();
void updateFromSettings();
signals:
void valueChanged(QtProperty *property, QVariant value);
public slots:
void updateEntry(QtProperty *property, QVariant value);
private:
void updateFromEntry(QtVariantProperty* property, const EntryPtr &entry);
private:
QtVariantPropertyManager *variantManager_;
QtVariantEditorFactory *variantFactory_;
QtTreePropertyBrowser *variantEditor_;
QMap<QtVariantProperty*, EntryPtr> callbackEntryMap_;
};
} // namespace tvseg_ui
#endif // TVSEG_UI_SETTINGSEDITOR_H