PIValueTreeEdit individual grouping feature
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
#include "piqt.h"
|
||||
#include "qad_locations.h"
|
||||
|
||||
#include <QActionGroup>
|
||||
#include <QFileInfo>
|
||||
#include <QMetaEnum>
|
||||
#include <pifile.h>
|
||||
#include <pijson.h>
|
||||
#include <pivaluetree.h>
|
||||
@@ -15,7 +17,19 @@ MainWindow::MainWindow(QWidget * parent): EMainWindow(parent), Ui::MainWindow()
|
||||
session.setFile(QAD::userPath(QAD::ltConfig, "session_valuetreeeditor"));
|
||||
session.addEntry(this);
|
||||
session.load();
|
||||
widget->setGroupingEnabled(actionGrouping->isChecked());
|
||||
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) {
|
||||
if (me.value(i) == PIValueTreeEdit::Parent) continue;
|
||||
auto * a = ag->addAction(me.key(i));
|
||||
a->setCheckable(true);
|
||||
a->setData(me.value(i));
|
||||
if (me.value(i) == PIValueTreeEdit::Indent) a->setChecked(true);
|
||||
}
|
||||
menuView->addActions(ag->actions());
|
||||
widget->setFullEditMode(actionFull_edit_mode->isChecked());
|
||||
}
|
||||
|
||||
@@ -80,11 +94,6 @@ QString MainWindow::loadFilter() {
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionGrouping_toggled(bool on) {
|
||||
widget->setGroupingEnabled(on);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionFull_edit_mode_toggled(bool on) {
|
||||
widget->setFullEditMode(on);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,12 @@ public:
|
||||
bool save(const QString & path) override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
void changeEvent(QEvent * e) override;
|
||||
|
||||
QString loadFilter() override;
|
||||
QString saveFilter() override { return loadFilter(); }
|
||||
|
||||
private slots:
|
||||
void on_actionGrouping_toggled(bool on);
|
||||
void on_actionFull_edit_mode_toggled(bool on);
|
||||
};
|
||||
|
||||
|
||||
@@ -44,13 +44,20 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>446</height>
|
||||
<height>444</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="PIValueTreeEdit" name="widget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -94,8 +101,8 @@
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
<addaction name="actionGrouping"/>
|
||||
<addaction name="actionFull_edit_mode"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
@@ -138,7 +145,7 @@
|
||||
</action>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/widgets/qad_widgets.qrc">
|
||||
<iconset resource="../../libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/document-new.png</normaloff>:/icons/document-new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -157,14 +164,6 @@
|
||||
<string>About ...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGrouping">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Grouping</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFull_edit_mode">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@@ -189,6 +188,7 @@
|
||||
<resources>
|
||||
<include location="../../../cd/utils/pult/cdpult.qrc"/>
|
||||
<include location="../../libs/blockview/qad_blockview.qrc"/>
|
||||
<include location="../../libs/qglview/qglview.qrc"/>
|
||||
<include location="../../libs/widgets/qad_widgets.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
|
||||
Reference in New Issue
Block a user