Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
better icon sizes
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4861 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Feb 15, 2006
1 parent e088e62 commit 778f179
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/plugins/grass/qgsgrasstools.cpp
Expand Up @@ -77,7 +77,16 @@ extern "C" {
QgsGrassToolsTabWidget::QgsGrassToolsTabWidget( QWidget * parent ):
QTabWidget(parent)
{
tabBar()->setIconSize( QSize(125,25) );
// Default height seems to be too small for our purpose
int height = 1.5 * tabBar()->iconSize().height();
// Max width (see QgsGrassModule::pixmap for hardcoded sizes)
int width = 3*height + 28 + 29;
tabBar()->setIconSize( QSize(width,height) );
}

QSize QgsGrassToolsTabWidget::iconSize()
{
return tabBar()->iconSize();
}

QgsGrassToolsTabWidget::~QgsGrassToolsTabWidget() {}
Expand Down Expand Up @@ -198,9 +207,21 @@ void QgsGrassTools::moduleClicked( Q3ListViewItem * item )
mQgisApp, mIface, path, mTabWidget ) );
}

QPixmap pixmap = QgsGrassModule::pixmap ( path, 25 );
int height = mTabWidget->iconSize().height();
QPixmap pixmap = QgsGrassModule::pixmap ( path, height );

// Icon size in QT4 does not seem to be variable
// -> put smaller icons in the middle
QPixmap pixmap2 ( mTabWidget->iconSize() );
QPalette pal;
pixmap2.fill ( pal.color(QPalette::Window) );
QPainter painter(&pixmap2);
int x = (int) ( (mTabWidget->iconSize().width()-pixmap.width())/2 );
painter.drawPixmap ( x, 0, pixmap );
painter.end();

QIcon is;
is.addPixmap ( pixmap );
is.addPixmap ( pixmap2 );
mTabWidget->addTab ( m, is, "" );

QgsGrassToolsTabWidget tw;
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/grass/qgsgrasstools.h
Expand Up @@ -31,6 +31,7 @@ class QDomElement;
class QgsGrassProvider;
#include <QDialog>
#include <QTabBar>
class QSize;

class QgsGrassToolsTabWidget: public QTabWidget
{
Expand All @@ -42,6 +43,8 @@ class QgsGrassToolsTabWidget: public QTabWidget

//! Destructor
~QgsGrassToolsTabWidget();

QSize iconSize();
};

/*! \class QgsGrassTools
Expand Down

0 comments on commit 778f179

Please sign in to comment.