summaryrefslogtreecommitdiff
path: root/utils/themeeditor
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-16 19:24:53 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-16 19:24:53 +0000
commit60d5f5050b00e05385cbe55a9d639a56e013ff3f (patch)
tree38b7efcd2745e2e45d7d6ab2d0000af634417435 /utils/themeeditor
parent23b9df2890480e2a6e20f13f041f8f8bc2a2ccef (diff)
Theme Editor: Items from line under cursor now selected in parse tree view
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26870 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/editorwindow.cpp14
-rw-r--r--utils/themeeditor/editorwindow.h2
-rw-r--r--utils/themeeditor/editorwindow.ui5
3 files changed, 19 insertions, 2 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 56968a3c05..0721ee9131 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -101,7 +101,6 @@ void EditorWindow::loadSettings()
restoreState(state);
}
-
}
void EditorWindow::saveSettings()
@@ -137,6 +136,7 @@ void EditorWindow::setupUI()
parseStatus = new QLabel(this);
ui->statusbar->addPermanentWidget(parseStatus);
+ parseTreeSelection = 0;
}
void EditorWindow::setupMenus()
@@ -400,10 +400,14 @@ void EditorWindow::updateCurrent()
void EditorWindow::lineChanged(int line)
{
ui->parseTree->collapseAll();
+ if(parseTreeSelection)
+ parseTreeSelection->deleteLater();
ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
(ui->parseTree->model());
+ parseTreeSelection = new QItemSelectionModel(model);
expandLine(model, QModelIndex(), line);
sizeColumns();
+ ui->parseTree->setSelectionModel(parseTreeSelection);
}
@@ -412,6 +416,10 @@ void EditorWindow::expandLine(ParseTreeModel* model, QModelIndex parent,
{
for(int i = 0; i < model->rowCount(parent); i++)
{
+ QModelIndex dataType = model->index(i, ParseTreeModel::typeColumn,
+ parent);
+ QModelIndex dataVal = model->index(i, ParseTreeModel::valueColumn,
+ parent);
QModelIndex data = model->index(i, ParseTreeModel::lineColumn, parent);
QModelIndex recurse = model->index(i, 0, parent);
@@ -422,6 +430,10 @@ void EditorWindow::expandLine(ParseTreeModel* model, QModelIndex parent,
ui->parseTree->expand(parent);
ui->parseTree->expand(data);
ui->parseTree->scrollTo(parent, QAbstractItemView::PositionAtTop);
+
+ parseTreeSelection->select(data, QItemSelectionModel::Select);
+ parseTreeSelection->select(dataType, QItemSelectionModel::Select);
+ parseTreeSelection->select(dataVal, QItemSelectionModel::Select);
}
}
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index 51ca7a692d..0dee4a1e6e 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -24,6 +24,7 @@
#include <QMainWindow>
#include <QLabel>
+#include <QItemSelectionModel>
#include "parsetreemodel.h"
#include "skinhighlighter.h"
@@ -84,6 +85,7 @@ private:
PreferencesDialog* prefs;
QLabel* parseStatus;
ProjectModel* project;
+ QItemSelectionModel* parseTreeSelection;
};
#endif // EDITORWINDOW_H
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui
index 06c7d422bd..11cfb6b94f 100644
--- a/utils/themeeditor/editorwindow.ui
+++ b/utils/themeeditor/editorwindow.ui
@@ -40,7 +40,7 @@
<x>0</x>
<y>0</y>
<width>628</width>
- <height>25</height>
+ <height>27</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -130,6 +130,9 @@
<property name="alternatingRowColors">
<bool>true</bool>
</property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::MultiSelection</enum>
+ </property>
</widget>
</item>
<item>