PIValueTreeEdit individual grouping feature
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#include "pivaluetree_edit_parameters.h"
|
||||
|
||||
#include "piqt.h"
|
||||
#include "pivaluetree_edit.h"
|
||||
#include "pivariant_edit.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QMetaEnum>
|
||||
|
||||
using Attribute = PIValueTree::Attribute;
|
||||
|
||||
@@ -13,6 +15,19 @@ const char property_name[] = "__name__";
|
||||
|
||||
PIValueTreeEditParameters::PIValueTreeEditParameters(QWidget * parent): QDialog(parent) {
|
||||
setupUi(this);
|
||||
auto * ag = new QActionGroup(this);
|
||||
ag->setExclusive(true);
|
||||
// connect(ag, &QActionGroup::triggered, [this](QAction * a) { widget->setGrouping((PIValueTreeEdit::Grouping)a->data().toInt()); });
|
||||
auto mo = PIValueTreeEdit::staticMetaObject;
|
||||
auto me = mo.enumerator(mo.indexOfEnumerator("Grouping"));
|
||||
for (int i = 0; i < me.keyCount(); ++i) {
|
||||
auto * a = ag->addAction(me.key(i));
|
||||
a->setCheckable(true);
|
||||
a->setData(me.value(i));
|
||||
if (me.value(i) == PIValueTreeEdit::Indent) a->setChecked(true);
|
||||
}
|
||||
menu_grouping.addActions(ag->actions());
|
||||
menu_grouping.menuAction()->setText(tr("Grouping"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user