Skip to content

Commit a039bdd

Browse files
author
telwertowski
committed
Reduce default height of QgsColorButton. For Mac, only show color when window is active.
git-svn-id: http://svn.osgeo.org/qgis/trunk@6308 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ead3530 commit a039bdd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/gui/qgscolorbutton.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434

3535
QgsColorButton::QgsColorButton(QWidget *parent)
3636
: QToolButton(parent)
37-
{}
37+
{
38+
setToolButtonStyle(Qt::ToolButtonTextOnly); // decrease default button height
39+
}
3840

3941
QgsColorButton::~QgsColorButton()
4042
{}
@@ -45,7 +47,12 @@ QgsColorButton::~QgsColorButton()
4547
void QgsColorButton::paintEvent(QPaintEvent *e)
4648
{
4749
QToolButton::paintEvent(e);
48-
if (isEnabled())
50+
if (
51+
#ifdef Q_WS_MAC
52+
// Mac shows color only a when a window is active
53+
isActiveWindow() &&
54+
#endif
55+
isEnabled())
4956
{
5057
QPainter p(this);
5158
int margin = 2; // Leave some space for highlighting

0 commit comments

Comments
 (0)