Skip to content

Commit 366645d

Browse files
author
timlinux
committed
Display the grass modules list as second tab which avoids rendering issues. Enabled list mode.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8595 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 41e4dea commit 366645d

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

src/plugins/grass/qgsgrasstools.cpp

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,34 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
133133
QVBoxLayout *layout1 = new QVBoxLayout(this);
134134
layout1->addWidget(mTabWidget);
135135

136+
//
137+
// Radims original tree view code.
138+
//
139+
// Warning: if the tree is not the first page modules are
140+
// displayed over the other pages on first load
141+
142+
mModulesListView = new QTreeWidget();
143+
mTabWidget->addTab( mModulesListView, tr("Modules Tree") );
144+
mModulesListView->setColumnCount(1);
145+
QStringList headers;
146+
headers << tr("Modules");
147+
mModulesListView->setHeaderLabels(headers);
148+
// Set list view
149+
mModulesListView->clear();
150+
mModulesListView->setSortingEnabled(false);
151+
mModulesListView->setRootIsDecorated(true);
152+
// mModulesListView->setResizeMode(QTreeWidget::AllColumns);
153+
mModulesListView->header()->hide();
154+
155+
connect( mModulesListView, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
156+
this, SLOT(moduleClicked( QTreeWidgetItem *, int)) );
157+
158+
QString title = tr("GRASS Tools: ") + QgsGrass::getDefaultLocation()
159+
+ "/" + QgsGrass::getDefaultMapset();
160+
setCaption(title);
161+
mModulesListView->show();
162+
163+
136164
//
137165
// Tims experimental list view with filter
138166
//
@@ -145,12 +173,13 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
145173
mListView->setFocus();
146174
mListView->setItemDelegateForColumn(0,new QgsDetailedItemDelegate());
147175
mListView->setUniformItemSizes(false);
176+
mListView->show();
148177
QWidget * mypBase = new QWidget(this);
149178
QVBoxLayout * mypListTabLayout = new QVBoxLayout(mypBase);
150179
mypListTabLayout->addWidget(mListView);
151180
mFilterInput = new QLineEdit(this);
152181
mypListTabLayout->addWidget(mFilterInput);
153-
//mTabWidget->addTab( mypBase, tr("Modules List") );
182+
mTabWidget->addTab( mypBase, tr("Modules List") );
154183
connect( mFilterInput, SIGNAL(textChanged(QString)),
155184
this, SLOT(filterChanged(QString)) );
156185
connect( mListView, SIGNAL(clicked(const QModelIndex)),
@@ -159,41 +188,19 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
159188
// End of Tims experimental bit
160189
//
161190

162-
mModulesListView = new QTreeWidget();
163-
mTabWidget->addTab( mModulesListView, tr("Modules Tree") );
164-
mModulesListView->setColumnCount(1);
165-
QStringList headers;
166-
headers << tr("Modules");
167-
mModulesListView->setHeaderLabels(headers);
168-
// Set list view
169-
mModulesListView->clear();
170-
mModulesListView->setSortingEnabled(false);
171-
mModulesListView->setRootIsDecorated(true);
172-
// mModulesListView->setResizeMode(QTreeWidget::AllColumns);
173-
mModulesListView->header()->hide();
174-
175-
connect( mModulesListView, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
176-
this, SLOT(moduleClicked( QTreeWidgetItem *, int)) );
177-
178-
QString title = tr("GRASS Tools: ") + QgsGrass::getDefaultLocation()
179-
+ "/" + QgsGrass::getDefaultMapset();
180-
setCaption(title);
181-
191+
//
192+
// Load the modules lists
193+
//
194+
// Show before loadConfig() so that user can see loading
182195
QString conf = QgsApplication::pkgDataPath() + "/grass/config/default.qgc";
183-
184196
restorePosition();
185197

186-
// Show before loadConfig() so that user can see loading
187-
mModulesListView->show();
188-
189198
QApplication::setOverrideCursor(Qt::waitCursor);
190199
loadConfig ( conf );
191200
QApplication::restoreOverrideCursor();
192201
//statusBar()->hide();
193202

194203
// Add map browser
195-
// Warning: if browser is on the first page modules are
196-
// displayed over the browser
197204
mBrowser = new QgsGrassBrowser ( mIface, this );
198205
mTabWidget->addTab( mBrowser, tr("Browser") );
199206

0 commit comments

Comments
 (0)