Skip to content

Commit

Permalink
Reduce default height of QgsColorButton. For Mac, only show color whe…
Browse files Browse the repository at this point in the history
…n window is active.

git-svn-id: http://svn.osgeo.org/qgis/trunk@6308 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Dec 22, 2006
1 parent ead3530 commit a039bdd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/gui/qgscolorbutton.cpp
Expand Up @@ -34,7 +34,9 @@

QgsColorButton::QgsColorButton(QWidget *parent)
: QToolButton(parent)
{}
{
setToolButtonStyle(Qt::ToolButtonTextOnly); // decrease default button height
}

QgsColorButton::~QgsColorButton()
{}
Expand All @@ -45,7 +47,12 @@ QgsColorButton::~QgsColorButton()
void QgsColorButton::paintEvent(QPaintEvent *e)
{
QToolButton::paintEvent(e);
if (isEnabled())
if (
#ifdef Q_WS_MAC
// Mac shows color only a when a window is active
isActiveWindow() &&
#endif
isEnabled())
{
QPainter p(this);
int margin = 2; // Leave some space for highlighting
Expand Down

0 comments on commit a039bdd

Please sign in to comment.