[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [PATCH] HighColor Style bug
From:       Martijn Klingens <mklingens () yahoo ! com>
Date:       2001-06-30 23:30:50
[Download RAW message or body]

The HighColor style had a bug that it didn't display a proper arrow for 
QPushButtons with the setPopup() property set. Attached patch should fix 
this. Please review.

Note that at least mega gradient and the pixmap theme engine have this same 
bug, but i haven't fixed those styles. Mega is straightforward, since the 
button code is probably identical, the pixmap theme will be harder to fix.

There is also the bug that all of these themes can't display flat buttons 
(QPushButton::setFlat()), but I don't know how those should be properly drawn 
in Mega and HCStyle. Maybe the maintainer should fix that ;-)

Martijn

["hcstyle-2.diff" (text/x-diff)]

Index: hcstyle.cpp
===================================================================
RCS file: /home/kde/kdelibs/kstyles/highcolor/hcstyle.cpp,v
retrieving revision 1.42
diff -b -u -p -r1.42 hcstyle.cpp
--- hcstyle.cpp	2001/06/17 02:52:30	1.42
+++ hcstyle.cpp	2001/06/30 23:24:12
@@ -493,7 +493,36 @@ void HCStyle::drawPushButtonLabel(QPushB
         ++x1, ++y1;
     }
 
-    // Draw iconset first, if any
+    // If this is a button with an associated popup menu, draw an arrow first
+    if ( btn->isMenuButton() )
+    {
+	int dx = menuButtonIndicatorWidth( btn->height() );
+
+	QColorGroup g( btn->colorGroup() );
+	int xx = x1 + w - dx - 4;
+	int yy = y1 - 3;
+	int hh = h + 6;
+
+	if ( !act )
+	{
+	    p->setPen( g.light() );
+	    p->drawLine( xx + 1, yy + 5, xx + 1, yy + hh - 6 );
+	    p->setPen( g.mid() );
+	    p->drawLine( xx, yy + 6, xx, yy + hh - 6 );
+	}
+	else
+	{
+	    p->setPen( g.button() );
+	    p->drawLine( xx, yy + 4, xx, yy + hh - 4 );
+	}
+	drawArrow( p, DownArrow, FALSE,
+		   x1 + w - dx - 2, y1 + 2, dx, h - 4,
+		   btn->colorGroup(),
+		   btn->isEnabled() );
+	w -= dx;
+    }
+
+    // Next, draw iconset, if any
     if ( btn->iconSet() && !btn->iconSet()->isNull() )
     {
 	QIconSet::Mode mode = btn->isEnabled()

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic