summaryrefslogtreecommitdiff
path: root/stylepalette.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'stylepalette.cpp')
-rw-r--r--stylepalette.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/stylepalette.cpp b/stylepalette.cpp
index 1416cc3..c599750 100644
--- a/stylepalette.cpp
+++ b/stylepalette.cpp
@@ -61,6 +61,30 @@ void StylePalette::reloadStyles()
}
}
+void StylePalette::changeStyle(int increment)
+{
+ QModelIndexList i = ui->styleListView->selectionModel()->selectedIndexes();
+ int row = 0;
+ if (!i.isEmpty()) {
+ int row = (i[0].row()+increment)%_model->rowCount();
+ if (row < 0) row += _model->rowCount();
+ }
+
+ QModelIndex i1 = ui->styleListView->rootIndex().child(row, 0);
+ ui->styleListView->selectionModel()->select(i1, QItemSelectionModel::ClearAndSelect);
+ ui->styleListView->scrollTo(i1);
+}
+
+void StylePalette::nextStyle()
+{
+ changeStyle(1);
+}
+
+void StylePalette::previousStyle()
+{
+ changeStyle(-1);
+}
+
QString StylePalette::activeNodeStyleName()
{
const QModelIndexList i = ui->styleListView->selectionModel()->selectedIndexes();