forked from len0rd/rockbox
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
This commit is contained in:
parent
23b9df2890
commit
60d5f5050b
3 changed files with 19 additions and 2 deletions
|
@ -101,7 +101,6 @@ void EditorWindow::loadSettings()
|
||||||
restoreState(state);
|
restoreState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorWindow::saveSettings()
|
void EditorWindow::saveSettings()
|
||||||
|
@ -137,6 +136,7 @@ void EditorWindow::setupUI()
|
||||||
parseStatus = new QLabel(this);
|
parseStatus = new QLabel(this);
|
||||||
ui->statusbar->addPermanentWidget(parseStatus);
|
ui->statusbar->addPermanentWidget(parseStatus);
|
||||||
|
|
||||||
|
parseTreeSelection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorWindow::setupMenus()
|
void EditorWindow::setupMenus()
|
||||||
|
@ -400,10 +400,14 @@ void EditorWindow::updateCurrent()
|
||||||
void EditorWindow::lineChanged(int line)
|
void EditorWindow::lineChanged(int line)
|
||||||
{
|
{
|
||||||
ui->parseTree->collapseAll();
|
ui->parseTree->collapseAll();
|
||||||
|
if(parseTreeSelection)
|
||||||
|
parseTreeSelection->deleteLater();
|
||||||
ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
|
ParseTreeModel* model = dynamic_cast<ParseTreeModel*>
|
||||||
(ui->parseTree->model());
|
(ui->parseTree->model());
|
||||||
|
parseTreeSelection = new QItemSelectionModel(model);
|
||||||
expandLine(model, QModelIndex(), line);
|
expandLine(model, QModelIndex(), line);
|
||||||
sizeColumns();
|
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++)
|
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 data = model->index(i, ParseTreeModel::lineColumn, parent);
|
||||||
QModelIndex recurse = model->index(i, 0, 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(parent);
|
||||||
ui->parseTree->expand(data);
|
ui->parseTree->expand(data);
|
||||||
ui->parseTree->scrollTo(parent, QAbstractItemView::PositionAtTop);
|
ui->parseTree->scrollTo(parent, QAbstractItemView::PositionAtTop);
|
||||||
|
|
||||||
|
parseTreeSelection->select(data, QItemSelectionModel::Select);
|
||||||
|
parseTreeSelection->select(dataType, QItemSelectionModel::Select);
|
||||||
|
parseTreeSelection->select(dataVal, QItemSelectionModel::Select);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QItemSelectionModel>
|
||||||
|
|
||||||
#include "parsetreemodel.h"
|
#include "parsetreemodel.h"
|
||||||
#include "skinhighlighter.h"
|
#include "skinhighlighter.h"
|
||||||
|
@ -84,6 +85,7 @@ private:
|
||||||
PreferencesDialog* prefs;
|
PreferencesDialog* prefs;
|
||||||
QLabel* parseStatus;
|
QLabel* parseStatus;
|
||||||
ProjectModel* project;
|
ProjectModel* project;
|
||||||
|
QItemSelectionModel* parseTreeSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EDITORWINDOW_H
|
#endif // EDITORWINDOW_H
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>628</width>
|
<width>628</width>
|
||||||
<height>25</height>
|
<height>27</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
@ -130,6 +130,9 @@
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::MultiSelection</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue