@@ -95,27 +95,14 @@ static QString getShortPath(const QString &path)
95
95
}
96
96
#endif
97
97
98
- QgsGrassToolsTabWidget::QgsGrassToolsTabWidget ( QWidget * parent ):
99
- QTabWidget(parent)
100
- {
101
- // Default height seems to be too small for our purpose
102
- int height = (int )(1.5 * tabBar ()->iconSize ().height ());
103
- // Max width (see QgsGrassModule::pixmap for hardcoded sizes)
104
- int width = 3 *height + 28 + 29 ;
105
- tabBar ()->setIconSize ( QSize (width,height) );
106
- }
107
-
108
- QSize QgsGrassToolsTabWidget::iconSize ()
109
- {
110
- return tabBar ()->iconSize ();
111
- }
112
98
113
- QgsGrassToolsTabWidget::~QgsGrassToolsTabWidget () {}
114
99
115
100
QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
116
101
QWidget * parent, const char * name, Qt::WFlags f )
117
- : QDialog ( parent )
102
+ : QDialog( parent, f ), QgsGrassToolsBase ( )
118
103
{
104
+
105
+ setupUi (this );
119
106
#ifdef QGISDEBUG
120
107
std::cerr << " QgsGrassTools()" << std::endl;
121
108
#endif
@@ -129,33 +116,12 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
129
116
connect ( qApp, SIGNAL (aboutToQuit ()),
130
117
this , SLOT (closeTools ()) );
131
118
132
- mTabWidget = new QgsGrassToolsTabWidget (this );
133
- QVBoxLayout *layout1 = new QVBoxLayout (this );
134
- layout1->addWidget (mTabWidget );
135
-
136
119
//
137
120
// Radims original tree view code.
138
121
//
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
-
122
+ mModulesTree ->header ()->hide ();
123
+ connect ( mModulesTree , SIGNAL (itemClicked (QTreeWidgetItem *, int )),
124
+ this , SLOT (moduleClicked ( QTreeWidgetItem *, int )) );
159
125
160
126
161
127
//
@@ -165,20 +131,16 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
165
131
mModelProxy = new QSortFilterProxyModel (this );
166
132
mModelProxy ->setSourceModel (mModelTools );
167
133
mModelProxy ->setFilterRole (Qt::UserRole + 2 );
168
- mListView = new QListView ();
134
+
169
135
mListView ->setModel (mModelProxy );
170
- mListView ->setFocus ();
171
136
mListView ->setItemDelegateForColumn (0 ,new QgsDetailedItemDelegate ());
172
137
mListView ->setUniformItemSizes (false );
173
-
174
- QWidget * mypBase = new QWidget (this );
175
- QVBoxLayout * mypListTabLayout = new QVBoxLayout (mypBase);
176
- mypListTabLayout->addWidget (mListView );
177
- mFilterInput = new QLineEdit (this );
178
- mypListTabLayout->addWidget (mFilterInput );
179
- mTabWidget ->addTab ( mypBase, tr (" Modules List" ) );
180
- connect ( mFilterInput , SIGNAL (textChanged (QString)),
181
- this , SLOT (filterChanged (QString)) );
138
+ // mListView2 = new QListView(this);
139
+ // mDockWidget = new QDockWidget(tr("Grass Tools"), 0);
140
+ // mDockWidget->setWidget(mListView2);
141
+ // mDockWidget->setObjectName("GrassTools");
142
+ // mDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
143
+ // mIface->addDockWidget(Qt::LeftDockWidgetArea, mDockWidget);
182
144
connect ( mListView , SIGNAL (clicked (const QModelIndex)),
183
145
this , SLOT (listItemClicked (const QModelIndex)));
184
146
//
@@ -201,8 +163,7 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
201
163
QString title = tr (" GRASS Tools: " ) + QgsGrass::getDefaultLocation ()
202
164
+ " /" + QgsGrass::getDefaultMapset ();
203
165
setCaption (title);
204
- mModulesListView ->show ();
205
- mListView ->show ();
166
+
206
167
207
168
// Add map browser
208
169
mBrowser = new QgsGrassBrowser ( mIface , this );
@@ -322,7 +283,6 @@ void QgsGrassTools::runModule(QString name)
322
283
is.addPixmap ( pixmap2 );
323
284
mTabWidget ->addTab ( m, is, " " );
324
285
325
- QgsGrassToolsTabWidget tw;
326
286
327
287
mTabWidget ->setCurrentPage ( mTabWidget ->count ()-1 );
328
288
@@ -338,8 +298,8 @@ bool QgsGrassTools::loadConfig(QString filePath)
338
298
#ifdef QGISDEBUG
339
299
std::cerr << " QgsGrassTools::loadConfig(): " << filePath.toLocal8Bit ().data () << std::endl;
340
300
#endif
341
- mModulesListView ->clear ();
342
- mModulesListView ->setIconSize (QSize (80 ,22 ));
301
+ mModulesTree ->clear ();
302
+ mModulesTree ->setIconSize (QSize (80 ,22 ));
343
303
344
304
QFile file ( filePath );
345
305
@@ -407,15 +367,15 @@ void QgsGrassTools::addModules ( QTreeWidgetItem *parent, QDomElement &element
407
367
}
408
368
else
409
369
{
410
- item = new QTreeWidgetItem ( mModulesListView , lastItem );
370
+ item = new QTreeWidgetItem ( mModulesTree , lastItem );
411
371
}
412
372
413
373
if ( e.tagName () == " section" )
414
374
{
415
375
QString label = e.attribute (" label" );
416
376
QgsDebugMsg ( QString (" label = %1" ).arg (label) );
417
377
item->setText ( 0 , label );
418
- item->setExpanded (true ); // for debuging to spare one click
378
+ item->setExpanded (true );
419
379
420
380
addModules ( item, e );
421
381
@@ -548,7 +508,7 @@ void QgsGrassTools::closeTools()
548
508
// Helper function for Tim's experimental model list
549
509
//
550
510
551
- void QgsGrassTools::filterChanged (QString theText)
511
+ void QgsGrassTools::on_mFilterInput_textChanged (QString theText)
552
512
{
553
513
QgsDebugMsg (" PluginManager filter changed to :" + theText);
554
514
QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax (QRegExp::RegExp);
0 commit comments