Use semicolon as string list separator. Fixed bug in tree view state parameter passing.

p4#: 21350
This commit is contained in:
Magne Sjaastad 2013-04-22 09:20:57 +02:00
parent 6cac031fff
commit a9e0554635
3 changed files with 8 additions and 11 deletions

View File

@ -1246,17 +1246,15 @@ void storeExpandedState(QStringList & nodes, QTreeView * view, QAbstractItemMode
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimUiTreeView::applyTreeViewState(const QString& treeViewState) void RimUiTreeView::applyTreeViewStateFromString(const QString& treeViewState)
{ {
if (this->model()) if (this->model())
{ {
this->collapseAll(); this->collapseAll();
QString stateString = RiaApplication::instance()->project()->treeViewState; QStringList nodes = treeViewState.split(";");
QStringList nodes = stateString.split("|");
QString path; QString path;
setExpandedState(nodes, this, this->model(), QModelIndex(), path); setExpandedState(nodes, this, this->model(), QModelIndex(), path);
} }
} }
@ -1264,7 +1262,7 @@ void RimUiTreeView::applyTreeViewState(const QString& treeViewState)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimUiTreeView::storeTreeViewState(QString& treeViewState) void RimUiTreeView::storeTreeViewStateToString(QString& treeViewState)
{ {
if (this->model()) if (this->model())
{ {
@ -1273,8 +1271,7 @@ void RimUiTreeView::storeTreeViewState(QString& treeViewState)
storeExpandedState(nodes, this, this->model(), QModelIndex(), path); storeExpandedState(nodes, this, this->model(), QModelIndex(), path);
QString stateString = nodes.join("|"); treeViewState = nodes.join(";");
RiaApplication::instance()->project()->treeViewState = stateString;
} }
} }

View File

@ -43,8 +43,8 @@ public:
virtual void setModel(QAbstractItemModel* model); virtual void setModel(QAbstractItemModel* model);
void applyTreeViewState(const QString& treeViewState); void applyTreeViewStateFromString(const QString& treeViewState);
void storeTreeViewState(QString& treeViewState); void storeTreeViewStateToString(QString& treeViewState);
protected: protected:
void contextMenuEvent(QContextMenuEvent* event); void contextMenuEvent(QContextMenuEvent* event);

View File

@ -1424,7 +1424,7 @@ void RiuMainWindow::storeTreeViewState()
{ {
QString treeViewState; QString treeViewState;
m_treeView->storeTreeViewState(treeViewState); m_treeView->storeTreeViewStateToString(treeViewState);
RiaApplication::instance()->project()->treeViewState = treeViewState; RiaApplication::instance()->project()->treeViewState = treeViewState;
} }
@ -1441,7 +1441,7 @@ void RiuMainWindow::restoreTreeViewState()
if (!stateString.isEmpty()) if (!stateString.isEmpty())
{ {
m_treeView->collapseAll(); m_treeView->collapseAll();
m_treeView->applyTreeViewState(stateString); m_treeView->applyTreeViewStateFromString(stateString);
} }
} }
} }