From f085393232f29237e7d6bfb1469d77a78e4a511a Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Mon, 1 Oct 2018 17:46:11 +0200 Subject: moving properties up and down --- src/gui/styleeditor.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/gui') 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() -- cgit v1.2.3