added a ruler for measuring

added support for meta-data editing
improved element selection
changed zooming
fixed some issues with layer events
fixed issue with 3D outline
fixed loading issue for old maps
some interface changes
This commit is contained in:
2017-03-10 13:44:17 +01:00
parent 2297a76c53
commit f40fc9a823
32 changed files with 809 additions and 198 deletions

67
params/MetaEditWidget.cpp Normal file
View File

@@ -0,0 +1,67 @@
#include "MetaEditWidget.h"
#include "MetaEditModel.h"
#include <QTableView>
#include <QGridLayout>
#include <QKeyEvent>
#include <QPushButton>
MetaEditWidget::MetaEditWidget(Floorplan::Meta* meta) : QWidget(nullptr), metaOrig(meta) {
// local copy. for the abort button [orig is unchanged]
metaCopy.params = metaOrig->params;
QGridLayout* lay = new QGridLayout(this);
tbl = new QTableView();
lay->addWidget(tbl, 0, 0, 1, 3);
model = new MetaEditModel();
model->setSource(&metaCopy); // we edit the copy
tbl->setModel(model);
tbl->setSelectionBehavior(QAbstractItemView::SelectRows);
tbl->setSelectionMode(QAbstractItemView::SingleSelection);
// events
QPushButton* btnAdd = new QPushButton("add entry");
lay->addWidget(btnAdd, 1, 0);
btnAdd->connect(btnAdd, &QPushButton::clicked, [this] (const bool) {
model->addEntry();
});
btnAdd->setToolTip("add a new, empty entry. delete an entry using the keyboard");
QPushButton* btnCancel = new QPushButton("abort");
lay->addWidget(btnCancel, 1, 1);
btnCancel->connect(btnCancel, &QPushButton::clicked, [this] (const bool) {
// do not apply changes. juts close
close();
});
btnCancel->setToolTip("close the dialog without committing the changes");
QPushButton* btnOK = new QPushButton("OK");
lay->addWidget(btnOK, 1, 2);
btnOK->connect(btnOK, &QPushButton::clicked, [this] (const bool) {
metaOrig->params = metaCopy.params; // apply changed
close();
});
btnOK->setToolTip("commit the changes and close the dialog");
// sizing
resize(500,400);
}
void MetaEditWidget::keyPressEvent(QKeyEvent* e) {
if (e->key() == Qt::Key_Delete) {
QModelIndexList indices = tbl->selectionModel()->selectedIndexes();
for (const QModelIndex& idx : indices) {
model->deleteEntry(idx.row());
break; // the list contains one entry per column!
}
}
}