diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-10-01 17:46:11 +0200 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-10-01 17:46:11 +0200 |
commit | f085393232f29237e7d6bfb1469d77a78e4a511a (patch) | |
tree | 7a7f47a659963f0a8b117982c1e85e1df59fbfe9 /src/gui | |
parent | e7a10091b64ddeb1d3e21e3f36abbf412021c815 (diff) |
moving properties up and down
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/styleeditor.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/gui/styleeditor.cpp b/src/gui/styleeditor.cpp index fbf73a9..f6e3f48 100644 --- a/src/gui/styleeditor.cpp +++ b/src/gui/styleeditor.cpp @@ -447,17 +447,46 @@ void StyleEditor::on_addAtom_clicked() void StyleEditor::on_removeProperty_clicked() { - + Style *s = activeStyle(); + if (s != 0) { + QModelIndexList sel = ui->properties->selectionModel()->selectedRows(); + if (!sel.isEmpty()) { + s->data()->removeRows(sel[0].row(), 1, sel[0].parent()); + _dirty = true; + } + } } void StyleEditor::on_propertyUp_clicked() { - + Style *s = activeStyle(); + if (s != 0) { + QModelIndexList sel = ui->properties->selectionModel()->selectedRows(); + if (!sel.isEmpty()) { + s->data()->moveRows( + sel[0].parent(), + sel[0].row(), 1, + sel[0].parent(), + sel[0].row() - 1); + _dirty = true; + } + } } void StyleEditor::on_propertyDown_clicked() { - + Style *s = activeStyle(); + if (s != 0) { + QModelIndexList sel = ui->properties->selectionModel()->selectedRows(); + if (!sel.isEmpty()) { + s->data()->moveRows( + sel[0].parent(), + sel[0].row(), 1, + sel[0].parent(), + sel[0].row() + 2); + _dirty = true; + } + } } void StyleEditor::on_save_clicked() |