@@ -95,27 +95,14 @@ static QString getShortPath(const QString &path)
9595}
9696#endif
9797
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- }
11298
113- QgsGrassToolsTabWidget::~QgsGrassToolsTabWidget () {}
11499
115100QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
116101 QWidget * parent, const char * name, Qt::WFlags f )
117- : QDialog ( parent )
102+ : QDialog( parent, f ), QgsGrassToolsBase ( )
118103{
104+
105+ setupUi (this );
119106#ifdef QGISDEBUG
120107 std::cerr << " QgsGrassTools()" << std::endl;
121108#endif
@@ -129,33 +116,12 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
129116 connect ( qApp, SIGNAL (aboutToQuit ()),
130117 this , SLOT (closeTools ()) );
131118
132- mTabWidget = new QgsGrassToolsTabWidget (this );
133- QVBoxLayout *layout1 = new QVBoxLayout (this );
134- layout1->addWidget (mTabWidget );
135-
136119 //
137120 // Radims original tree view code.
138121 //
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 )) );
159125
160126
161127 //
@@ -165,20 +131,16 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
165131 mModelProxy = new QSortFilterProxyModel (this );
166132 mModelProxy ->setSourceModel (mModelTools );
167133 mModelProxy ->setFilterRole (Qt::UserRole + 2 );
168- mListView = new QListView ();
134+
169135 mListView ->setModel (mModelProxy );
170- mListView ->setFocus ();
171136 mListView ->setItemDelegateForColumn (0 ,new QgsDetailedItemDelegate ());
172137 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);
182144 connect ( mListView , SIGNAL (clicked (const QModelIndex)),
183145 this , SLOT (listItemClicked (const QModelIndex)));
184146 //
@@ -201,8 +163,7 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
201163 QString title = tr (" GRASS Tools: " ) + QgsGrass::getDefaultLocation ()
202164 + " /" + QgsGrass::getDefaultMapset ();
203165 setCaption (title);
204- mModulesListView ->show ();
205- mListView ->show ();
166+
206167
207168 // Add map browser
208169 mBrowser = new QgsGrassBrowser ( mIface , this );
@@ -322,7 +283,6 @@ void QgsGrassTools::runModule(QString name)
322283 is.addPixmap ( pixmap2 );
323284 mTabWidget ->addTab ( m, is, " " );
324285
325- QgsGrassToolsTabWidget tw;
326286
327287 mTabWidget ->setCurrentPage ( mTabWidget ->count ()-1 );
328288
@@ -338,8 +298,8 @@ bool QgsGrassTools::loadConfig(QString filePath)
338298#ifdef QGISDEBUG
339299 std::cerr << " QgsGrassTools::loadConfig(): " << filePath.toLocal8Bit ().data () << std::endl;
340300#endif
341- mModulesListView ->clear ();
342- mModulesListView ->setIconSize (QSize (80 ,22 ));
301+ mModulesTree ->clear ();
302+ mModulesTree ->setIconSize (QSize (80 ,22 ));
343303
344304 QFile file ( filePath );
345305
@@ -407,15 +367,15 @@ void QgsGrassTools::addModules ( QTreeWidgetItem *parent, QDomElement &element
407367 }
408368 else
409369 {
410- item = new QTreeWidgetItem ( mModulesListView , lastItem );
370+ item = new QTreeWidgetItem ( mModulesTree , lastItem );
411371 }
412372
413373 if ( e.tagName () == " section" )
414374 {
415375 QString label = e.attribute (" label" );
416376 QgsDebugMsg ( QString (" label = %1" ).arg (label) );
417377 item->setText ( 0 , label );
418- item->setExpanded (true ); // for debuging to spare one click
378+ item->setExpanded (true );
419379
420380 addModules ( item, e );
421381
@@ -548,7 +508,7 @@ void QgsGrassTools::closeTools()
548508// Helper function for Tim's experimental model list
549509//
550510
551- void QgsGrassTools::filterChanged (QString theText)
511+ void QgsGrassTools::on_mFilterInput_textChanged (QString theText)
552512{
553513 QgsDebugMsg (" PluginManager filter changed to :" + theText);
554514 QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax (QRegExp::RegExp);
0 commit comments