add QAD valuetreeeditor util
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
#include "blockeditor.h"
|
||||
#include "qad_locations.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
enableHighDPI();
|
||||
a.setWindowIcon(QIcon(":/icons/blockview.png"));
|
||||
enableHighDPI();
|
||||
QAD::loadTranslations();
|
||||
BlockEditor w;
|
||||
if (a.arguments().size() > 1) w.loadFile(a.arguments().back());
|
||||
w.show();
|
||||
|
||||
@@ -1,105 +1,33 @@
|
||||
#include "pifile.h"
|
||||
#include "pijson.h"
|
||||
#include "piqt_connection_edit.h"
|
||||
#include "pivaluetree_conversions.h"
|
||||
#include "pivaluetree_edit.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollArea>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <evalspinbox.h>
|
||||
#include <piintrospection_server.h>
|
||||
#include <qad_types.h>
|
||||
#include <qpiconfig.h>
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
|
||||
PIValueTree root, group, array;
|
||||
root.addChild({"bool", false});
|
||||
root.addChild({
|
||||
"integer",
|
||||
256,
|
||||
{{PIValueTree::Attribute::minimum, -100}, {PIValueTree::Attribute::maximum, 200}, {PIValueTree::Attribute::singleStep, 5}}
|
||||
});
|
||||
root.addChild({"Label here", PIVariant(), {{PIValueTree::Attribute::isLabel, true}}});
|
||||
root.addChild({"string", "str"});
|
||||
group.addChild({"substr", "str2"});
|
||||
group.addChild({"real", 12.3});
|
||||
group.setName("group");
|
||||
array.setAttribute(PIValueTree::Attribute::arrayType, "string");
|
||||
array.setAttribute(PIValueTree::Attribute::arrayResize, true);
|
||||
array.setAttribute(PIValueTree::Attribute::arrayMinCount, 0);
|
||||
array.setAttribute(PIValueTree::Attribute::arrayMaxCount, 10);
|
||||
array.setName("array");
|
||||
array.addChild({"0", "1E+2"});
|
||||
array.addChild({"1", -5});
|
||||
array.addChild({"3", 0.1});
|
||||
root.addChild(group);
|
||||
root.addChild(array);
|
||||
PIString json = PIValueTreeConversions::toJSON(root).toJSON(PIJSON::Tree);
|
||||
// piCout << PIValueTreeConversions::fromJSON(PIJSON::fromJSON(json));
|
||||
|
||||
PIFile f("C:/work/config.conf", PIIODevice::ReadOnly);
|
||||
auto vt = PIValueTreeConversions::fromText(&f);
|
||||
PIVariantTypes::Enum en;
|
||||
en << "first"
|
||||
<< "second";
|
||||
en << PIVariantTypes::Enumerator(10, "TEN");
|
||||
en.selectValue(1);
|
||||
vt.addChild({"Enum", en});
|
||||
// piCout << PIValueTreeConversions::toText(vt);
|
||||
|
||||
QScrollArea area;
|
||||
area.setWidgetResizable(true);
|
||||
PIValueTreeEdit e;
|
||||
e.setGroupingEnabled(true);
|
||||
e.setFullEditMode(true);
|
||||
e.setGeometry(500, 400, 100, 50);
|
||||
// e.setValue(PIValueTreeConversions::fromJSON(PIJSON::fromJSON(PIValueTreeConversions::toJSON(vt).toJSON())));
|
||||
e.setValue(vt);
|
||||
area.setWidget(&e);
|
||||
area.show();
|
||||
// piCout << PIValueTreeConversions::toText(e.value()); //.toJSON(PIJSON::Tree);
|
||||
|
||||
QTimer timer;
|
||||
QObject::connect(&timer, &QTimer::timeout, [&]() { e.rollback(); });
|
||||
// timer.start(5);
|
||||
QTimer::singleShot(1000, [&e]() {
|
||||
auto * qtr = new QTranslator();
|
||||
qtr->load("c:/work/test_ru.qm");
|
||||
qApp->installTranslator(qtr);
|
||||
});
|
||||
// QTimer::singleShot(2000, [&e, vt]() {
|
||||
// e.setValue(PIValueTreeConversions::fromText(PIValueTreeConversions::toText(vt) + "\n[]\nAHAHA = 123\n"));
|
||||
//});
|
||||
// QTimer::singleShot(3000, [&e]() { e.setFullEditMode(false); });
|
||||
return a.exec();
|
||||
|
||||
/*
|
||||
PIINTROSPECTION_START(piconnedit)
|
||||
QApplication a(argc, argv);
|
||||
enableHighDPI();
|
||||
ConnectionEdit w;
|
||||
if (a.arguments().size() > 1) {
|
||||
QPIConfig cfg(a.arguments()[1]);
|
||||
QByteArray model = cfg.getValue("connectionmodel").toByteArray();
|
||||
if (!model.isEmpty()) w.setModel(model);
|
||||
QPIConfig cfg(a.arguments()[1]);
|
||||
QByteArray model = cfg.getValue("connectionmodel").toByteArray();
|
||||
if (!model.isEmpty()) w.setModel(model);
|
||||
} else
|
||||
w.recreateConnection();
|
||||
w.recreateConnection();
|
||||
if (w.exec() == QDialog::Accepted) {
|
||||
QString c = QFileDialog::getSaveFileName(&w, "Save config to file", a.applicationDirPath(), "*.conf");
|
||||
if (!c.isEmpty()) {
|
||||
QFile f(c);
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
QTextStream ts(&f);
|
||||
ts << w.configuration();
|
||||
ts << "connectionmodel = " << QByteArray2QString(w.model()) << "\n";
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
QString c = QFileDialog::getSaveFileName(&w, "Save config to file", a.applicationDirPath(), "*.conf");
|
||||
if (!c.isEmpty()) {
|
||||
QFile f(c);
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
QTextStream ts(&f);
|
||||
ts << w.configuration();
|
||||
ts << "connectionmodel = " << QByteArray2QString(w.model()) << "\n";
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "piqt.h"
|
||||
#include "qad_locations.h"
|
||||
|
||||
@@ -16,8 +17,8 @@ MainWindow::MainWindow(QWidget * parent): QMainWindow(parent), Ui::MainWindow()
|
||||
#endif
|
||||
npal = epal = lineInput->palette();
|
||||
epal.setColor(lineInput->backgroundRole(), QColor(Qt::red).lighter(150));
|
||||
connect(&session, SIGNAL(loading(QPIConfig & )), this, SLOT(loading(QPIConfig & )));
|
||||
connect(&session, SIGNAL(saving(QPIConfig & )), this, SLOT(saving(QPIConfig & )));
|
||||
connect(&session, SIGNAL(loading(QPIConfig &)), this, SLOT(loading(QPIConfig &)));
|
||||
connect(&session, SIGNAL(saving(QPIConfig &)), this, SLOT(saving(QPIConfig &)));
|
||||
session.setFile(QAD::userPath(QAD::ltConfig, "session_qpicalc"));
|
||||
session.addEntry(this);
|
||||
session.addEntry(lineInput);
|
||||
@@ -28,18 +29,16 @@ MainWindow::MainWindow(QWidget * parent): QMainWindow(parent), Ui::MainWindow()
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow() {session.save();
|
||||
MainWindow::~MainWindow() {
|
||||
session.save();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::changeEvent(QEvent * e) {
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case QEvent::LanguageChange: retranslateUi(this); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +81,9 @@ void MainWindow::redrawGraphics() {
|
||||
|
||||
|
||||
void MainWindow::loading(QPIConfig & conf) {
|
||||
active_ = false;
|
||||
active_ = false;
|
||||
QStringList vars = conf.getValue("variables").toStringList();
|
||||
int vc = vars.size() / 2;
|
||||
int vc = vars.size() / 2;
|
||||
for (int i = 0; i < vc; ++i) {
|
||||
QTreeWidgetItem * ti = new QTreeWidgetItem(treeVariables);
|
||||
ti->setText(0, vars[i * 2]);
|
||||
@@ -110,8 +109,7 @@ void MainWindow::loading(QPIConfig & conf) {
|
||||
buttonGraphicClear->setEnabled(treeGraphics->topLevelItemCount() > 0);
|
||||
graphic->setVisualRect(conf.getValue("graphicRect", QRectF(-1., -1., 2., 2.)).toRectF());
|
||||
ba = conf.getValue("graphic_state").toByteArray();
|
||||
if (!ba.isEmpty())
|
||||
graphic->load(ba);
|
||||
if (!ba.isEmpty()) graphic->load(ba);
|
||||
on_tabWidget_currentChanged(0);
|
||||
redrawGraphics();
|
||||
active_ = true;
|
||||
@@ -133,7 +131,8 @@ void MainWindow::saving(QPIConfig & conf) {
|
||||
QTreeWidgetItem * ti = treeGraphics->topLevelItem(i);
|
||||
vars << QString::number(ti->background(1).color().rgb()) << ti->text(2);
|
||||
}
|
||||
QByteArray ba; QDataStream s(&ba, QIODevice::WriteOnly);
|
||||
QByteArray ba;
|
||||
QDataStream s(&ba, QIODevice::WriteOnly);
|
||||
s << graphic->allGraphics();
|
||||
conf.setValue("graphics", QByteArray2QString(ba));
|
||||
conf.setValue("graphicRect", graphic->visualRect());
|
||||
@@ -142,8 +141,10 @@ void MainWindow::saving(QPIConfig & conf) {
|
||||
|
||||
|
||||
void MainWindow::on_lineInput_textChanged(QString text) {
|
||||
if (evaluator.check(Q2PIString(text))) lineInput->setPalette(npal);
|
||||
else lineInput->setPalette(epal);
|
||||
if (evaluator.check(Q2PIString(text)))
|
||||
lineInput->setPalette(npal);
|
||||
else
|
||||
lineInput->setPalette(epal);
|
||||
labelParsed->setText(PI2QString(evaluator.expression()));
|
||||
labelError->setText(PI2QString(evaluator.error()));
|
||||
}
|
||||
@@ -151,36 +152,37 @@ void MainWindow::on_lineInput_textChanged(QString text) {
|
||||
|
||||
void MainWindow::on_lineInput_returnPressed() {
|
||||
bool ret = evaluator.check(Q2PIString(lineInput->text()));
|
||||
if (ret) lineInput->setPalette(npal);
|
||||
else lineInput->setPalette(epal);
|
||||
if (ret)
|
||||
lineInput->setPalette(npal);
|
||||
else
|
||||
lineInput->setPalette(epal);
|
||||
labelParsed->setText(PI2QString(evaluator.expression()));
|
||||
labelError->setText(PI2QString(evaluator.error()));
|
||||
if (!ret) return;
|
||||
complexd val = evaluator.evaluate();
|
||||
evaluator.setVariable(ans, val);
|
||||
if (val.imag() == 0) labelResult->setText(QString::number(val.real()));
|
||||
if (val.imag() == 0)
|
||||
labelResult->setText(QString::number(val.real()));
|
||||
else {
|
||||
if (val.real() == 0) labelResult->setText(QString::number(val.imag()) + "i");
|
||||
if (val.real() == 0)
|
||||
labelResult->setText(QString::number(val.imag()) + "i");
|
||||
else {
|
||||
if (val.imag() > 0) labelResult->setText(QString::number(val.real())
|
||||
+ " + " + QString::number(val.imag()) + "i");
|
||||
else labelResult->setText(QString::number(val.real())
|
||||
+ " - " + QString::number(fabs(val.imag())) + "i");
|
||||
if (val.imag() > 0)
|
||||
labelResult->setText(QString::number(val.real()) + " + " + QString::number(val.imag()) + "i");
|
||||
else
|
||||
labelResult->setText(QString::number(val.real()) + " - " + QString::number(fabs(val.imag())) + "i");
|
||||
}
|
||||
}
|
||||
if (lineInput->text().trimmed().isEmpty()) return;
|
||||
QTreeWidgetItem * ti = 0, * pti = 0;
|
||||
if (treeHistory->topLevelItemCount() > 0)
|
||||
pti = treeHistory->topLevelItem(treeHistory->topLevelItemCount() - 1);
|
||||
QTreeWidgetItem *ti = 0, *pti = 0;
|
||||
if (treeHistory->topLevelItemCount() > 0) pti = treeHistory->topLevelItem(treeHistory->topLevelItemCount() - 1);
|
||||
if (pti != 0)
|
||||
if (pti->text(0) == lineInput->text())
|
||||
return;
|
||||
if (pti->text(0) == lineInput->text()) return;
|
||||
ti = new QTreeWidgetItem(treeHistory);
|
||||
ti->setText(0, lineInput->text());
|
||||
ti->setText(1, labelResult->text());
|
||||
treeHistory->addTopLevelItem(ti);
|
||||
if (treeHistory->verticalScrollBar()->value() == treeHistory->verticalScrollBar()->maximum())
|
||||
treeHistory->scrollToBottom();
|
||||
if (treeHistory->verticalScrollBar()->value() == treeHistory->verticalScrollBar()->maximum()) treeHistory->scrollToBottom();
|
||||
}
|
||||
|
||||
|
||||
@@ -196,11 +198,16 @@ void MainWindow::on_treeGraphics_itemSelectionChanged() {
|
||||
|
||||
void MainWindow::on_treeGraphics_itemDoubleClicked(QTreeWidgetItem * item, int column) {
|
||||
Qt::ItemFlags f = item->flags();
|
||||
if (column != 1) f &= ~Qt::ItemIsEditable;
|
||||
else f |= Qt::ItemIsEditable;
|
||||
if (column != 1)
|
||||
f &= ~Qt::ItemIsEditable;
|
||||
else
|
||||
f |= Qt::ItemIsEditable;
|
||||
item->setFlags(f);
|
||||
if (column != 0) return;
|
||||
QColor col = QColorDialog::getColor(item->data(0, Qt::DecorationRole).value<QColor>(), this, "Select color for graphic", QColorDialog::ShowAlphaChannel);
|
||||
QColor col = QColorDialog::getColor(item->data(0, Qt::DecorationRole).value<QColor>(),
|
||||
this,
|
||||
"Select color for graphic",
|
||||
QColorDialog::ShowAlphaChannel);
|
||||
if (!col.isValid()) return;
|
||||
item->setData(0, Qt::DecorationRole, col);
|
||||
updateGraphics();
|
||||
@@ -219,8 +226,8 @@ void MainWindow::on_buttonVarAdd_clicked() {
|
||||
|
||||
|
||||
void MainWindow::on_buttonVarDel_clicked() {
|
||||
QList<QTreeWidgetItem * > si = treeVariables->selectedItems();
|
||||
foreach (QTreeWidgetItem * i, si)
|
||||
QList<QTreeWidgetItem *> si = treeVariables->selectedItems();
|
||||
foreach(QTreeWidgetItem * i, si)
|
||||
delete i;
|
||||
buttonVarClear->setEnabled(treeVariables->topLevelItemCount() > 0);
|
||||
}
|
||||
@@ -243,8 +250,8 @@ void MainWindow::on_buttonGraphicAdd_clicked() {
|
||||
|
||||
|
||||
void MainWindow::on_buttonGraphicDel_clicked() {
|
||||
QList<QTreeWidgetItem * > si = treeGraphics->selectedItems();
|
||||
foreach (QTreeWidgetItem * i, si)
|
||||
QList<QTreeWidgetItem *> si = treeGraphics->selectedItems();
|
||||
foreach(QTreeWidgetItem * i, si)
|
||||
delete i;
|
||||
buttonGraphicClear->setEnabled(treeGraphics->topLevelItemCount() > 0);
|
||||
updateGraphics();
|
||||
|
||||
19
utils/valuetreeeditor/CMakeLists.txt
Normal file
19
utils/valuetreeeditor/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
project(valuetreeeditor)
|
||||
if(APPLE)
|
||||
set(APP_ICON "")
|
||||
elseif(WIN32)
|
||||
set(APP_ICON "icons/valuetreeeditor.ico")
|
||||
else()
|
||||
set(APP_ICON "icons/valuetreeeditor.png")
|
||||
endif()
|
||||
set(APP_INFO "Editor for PIValueTree")
|
||||
qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_application;qad_piqt_utils")
|
||||
if (NOT DEFINED ANDROID_PLATFORM)
|
||||
foreach (_qv_ IN ITEMS 5 6)
|
||||
if (${LOCAL_FOUND${_qv_}})
|
||||
import_version(${PROJECT_NAME}${_qv_} ${PROJECT_NAME})
|
||||
import_deploy_properties(${PROJECT_NAME}${_qv_} ${PROJECT_NAME})
|
||||
deploy_target(${PROJECT_NAME}${_qv_} DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release ADD_MANIFEST)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
BIN
utils/valuetreeeditor/icons/valuetreeeditor.ico
Normal file
BIN
utils/valuetreeeditor/icons/valuetreeeditor.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
utils/valuetreeeditor/icons/valuetreeeditor.png
Normal file
BIN
utils/valuetreeeditor/icons/valuetreeeditor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
90
utils/valuetreeeditor/mainwindow.cpp
Normal file
90
utils/valuetreeeditor/mainwindow.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "piqt.h"
|
||||
#include "qad_locations.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <pifile.h>
|
||||
#include <pijson.h>
|
||||
#include <pivaluetree.h>
|
||||
#include <pivaluetree_conversions.h>
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget * parent): EMainWindow(parent), Ui::MainWindow() {
|
||||
setupUi(this);
|
||||
session.setFile(QAD::userPath(QAD::ltConfig, "session_valuetreeeditor"));
|
||||
session.addEntry(this);
|
||||
session.load();
|
||||
widget->setGroupingEnabled(actionGrouping->isChecked());
|
||||
widget->setFullEditMode(actionFull_edit_mode->isChecked());
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
session.save();
|
||||
session.clear(true);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::reset(bool) {
|
||||
widget->setValue(PIValueTree());
|
||||
setWindowTitle(tr("PIValueTree Editor"));
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::load(const QString & path) {
|
||||
PIFile f(Q2PIString(path), PIIODevice::ReadOnly);
|
||||
if (!f.isOpened()) return false;
|
||||
PIString ext = PIFile::FileInfo(f.path()).extension().toLowerCase();
|
||||
PIValueTree v;
|
||||
if (ext == "conf" || ext == "ini")
|
||||
v = PIValueTreeConversions::fromText(&f);
|
||||
else if (ext == "json")
|
||||
v = PIValueTreeConversions::fromJSON(PIJSON::fromJSON(PIString::fromUTF8(f.readAll())));
|
||||
else if (ext == "bin")
|
||||
v = piDeserialize<PIValueTree>(f.readAll());
|
||||
widget->setValue(v);
|
||||
setWindowTitle(tr("PIValueTree Editor - %1").arg(QFileInfo(path).fileName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool MainWindow::save(const QString & path) {
|
||||
PIFile f(Q2PIString(path), PIIODevice::ReadWrite);
|
||||
if (!f.isOpened()) return false;
|
||||
f.clear();
|
||||
PIString ext = PIFile::FileInfo(f.path()).extension().toLowerCase();
|
||||
auto v = widget->value();
|
||||
if (ext == "conf" || ext == "ini")
|
||||
f.write(PIValueTreeConversions::toText(v).toUTF8());
|
||||
else if (ext == "json")
|
||||
f.write(PIValueTreeConversions::toJSON(v).toJSON(PIJSON::Tree, false).toUTF8());
|
||||
else if (ext == "bin")
|
||||
f.write(piSerialize(v));
|
||||
setWindowTitle(tr("PIValueTree Editor - %1").arg(QFileInfo(path).fileName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::changeEvent(QEvent * e) {
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange: retranslateUi(this); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString MainWindow::loadFilter() {
|
||||
return "All types(*.conf *.ini *.json *.bin);;INI format(*.conf *.ini);;JSON(*.json);;Binary(*.bin)";
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionGrouping_toggled(bool on) {
|
||||
widget->setGroupingEnabled(on);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionFull_edit_mode_toggled(bool on) {
|
||||
widget->setFullEditMode(on);
|
||||
}
|
||||
32
utils/valuetreeeditor/mainwindow.h
Normal file
32
utils/valuetreeeditor/mainwindow.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "emainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
|
||||
class MainWindow
|
||||
: public EMainWindow
|
||||
, private Ui::MainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget * parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
void reset(bool full = false) override;
|
||||
bool load(const QString & path) override;
|
||||
bool save(const QString & path) override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
QString loadFilter() override;
|
||||
QString saveFilter() override { return loadFilter(); }
|
||||
|
||||
private slots:
|
||||
void on_actionGrouping_toggled(bool on);
|
||||
void on_actionFull_edit_mode_toggled(bool on);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
266
utils/valuetreeeditor/mainwindow.ui
Normal file
266
utils/valuetreeeditor/mainwindow.ui
Normal file
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>521</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PIValueTree Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaContent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>446</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="PIValueTreeEdit" name="widget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
<addaction name="actionGrouping"/>
|
||||
<addaction name="actionFull_edit_mode"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
</widget>
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/blockview/qad_blockview.qrc">
|
||||
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/blockview/qad_blockview.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAs">
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/widgets/qad_widgets.qrc">
|
||||
<normaloff>:/icons/document-save-as.png</normaloff>:/icons/document-save-as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save As...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Alt+Shift+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="../../libs/widgets/qad_widgets.qrc">
|
||||
<normaloff>:/icons/document-new.png</normaloff>:/icons/document-new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="icon">
|
||||
<iconset resource="../../../cd/utils/pult/cdpult.qrc">
|
||||
<normaloff>:/icons/dialog-information.png</normaloff>:/icons/dialog-information.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<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>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Full edit mode</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PIValueTreeEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>pivaluetree_edit.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../cd/utils/pult/cdpult.qrc"/>
|
||||
<include location="../../libs/blockview/qad_blockview.qrc"/>
|
||||
<include location="../../libs/widgets/qad_widgets.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>actionNew</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>newFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>389</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionOpen</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>openFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>389</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionSaveAs</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>saveAsFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>389</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionSave</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>saveFile()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>389</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>newFile()</slot>
|
||||
<slot>openFile()</slot>
|
||||
<slot>saveFile()</slot>
|
||||
<slot>saveAsFile()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
5
utils/valuetreeeditor/valuetreeeditor.qrc
Normal file
5
utils/valuetreeeditor/valuetreeeditor.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icons/valuetreeeditor.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
17
utils/valuetreeeditor/valuetreeeditor_main.cpp
Normal file
17
utils/valuetreeeditor/valuetreeeditor_main.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "mainwindow.h"
|
||||
#include "qad_locations.h"
|
||||
#include "qad_types.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
a.setWindowIcon(QIcon(":/icons/valuetreeeditor.png"));
|
||||
enableHighDPI();
|
||||
QAD::loadTranslations();
|
||||
MainWindow w;
|
||||
if (a.arguments().size() > 1) w.load(a.arguments().back());
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user