PIValueTreeEdit arrays fix, support for array comment (only from source now)

This commit is contained in:
2023-04-26 16:50:50 +03:00
parent 6b4bafd9cd
commit 4eefbe4e46
4 changed files with 33 additions and 18 deletions

View File

@@ -43,6 +43,7 @@ MainWindow::~MainWindow() {
void MainWindow::reset(bool) {
widget->setValue(PIValueTree());
setWindowTitle(tr("PIValueTree Editor"));
file_name.clear();
}
@@ -50,6 +51,7 @@ 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();
file_name = path;
PIValueTree v;
if (ext == "conf" || ext == "ini")
v = PIValueTreeConversions::fromText(&f);
@@ -67,6 +69,7 @@ bool MainWindow::save(const QString & path) {
PIFile f(Q2PIString(path), PIIODevice::ReadWrite);
if (!f.isOpened()) return false;
f.clear();
file_name = path;
PIString ext = PIFile::FileInfo(f.path()).extension().toLowerCase();
auto v = widget->value();
if (ext == "conf" || ext == "ini")