Skip to content

Commit

Permalink
[GRASS] show module name in tab if icon is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Feb 7, 2016
1 parent 8e48e97 commit 92e5f67
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/plugins/grass/qgsgrasstools.cpp
Expand Up @@ -318,17 +318,24 @@ void QgsGrassTools::runModule( QString name, bool direct )
QString path = QgsGrass::modulesConfigDirPath() + "/" + name;
QPixmap pixmap = QgsGrassModule::pixmap( path, height );

// Icon size in QT4 does not seem to be variable
// -> reset the width to max icon width
if ( mTabWidget->iconSize().width() < pixmap.width() )
if ( !pixmap.isNull() )
{
mTabWidget->setIconSize( QSize( pixmap.width(), mTabWidget->iconSize().height() ) );
}
// Icon size in QT4 does not seem to be variable
// -> reset the width to max icon width
if ( mTabWidget->iconSize().width() < pixmap.width() )
{
mTabWidget->setIconSize( QSize( pixmap.width(), mTabWidget->iconSize().height() ) );
}


QIcon is;
is.addPixmap( pixmap );
mTabWidget->addTab( m, is, "" );
QIcon is;
is.addPixmap( pixmap );
mTabWidget->addTab( m, is, "" );
}
else
{
mTabWidget->addTab( m, name );
}


mTabWidget->setCurrentIndex( mTabWidget->count() - 1 );
Expand Down

0 comments on commit 92e5f67

Please sign in to comment.