[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.4/kdegraphics/kpdf/ui
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-09-10 18:11:23
Message-ID: 1126375883.547033.10995.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 459399 by aacid:
Backport fix for bug 112332
M +3 -40 minibar.cpp
--- branches/KDE/3.4/kdegraphics/kpdf/ui/minibar.cpp #459398:459399
@@ -68,12 +68,7 @@
HoverButton( QWidget * parent );
protected:
- void mouseMoveEvent( QMouseEvent * e );
- void mouseReleaseEvent( QMouseEvent * e );
void paintEvent( QPaintEvent * e );
-
- private:
- bool m_hovering;
};
@@ -394,7 +389,7 @@
/** HoverButton **/
HoverButton::HoverButton( QWidget * parent )
- : QPushButton( parent ), m_hovering( false )
+ : QPushButton( parent )
{
setMouseTracking( true );
#if KDE_IS_VERSION(3,3,90)
@@ -402,48 +397,16 @@
#endif
}
-void HoverButton::mouseMoveEvent( QMouseEvent * e )
-{
- // check for mouse hovering
- const QRect myGeom( 0,0, width(), height() );
- bool hover = myGeom.contains( e->pos() );
-
- // if hover state changed update gfx
- if ( m_hovering != hover )
- {
- m_hovering = hover;
- update();
- }
-}
-
-void HoverButton::mouseReleaseEvent( QMouseEvent * e )
-{
- // call default handler
- QPushButton::mouseReleaseEvent( e );
-
- // reset hover state when clicking
- m_hovering = false;
- update();
-}
-
void HoverButton::paintEvent( QPaintEvent * e )
{
- // always not hovering in disabled state
- if ( !isEnabled() )
- m_hovering = false;
-
- // paint button in different flavours
- if ( m_hovering )
+ if ( hasMouse() )
{
- // if we're hovering the button, draw it using QPushButton style
- setPaletteBackgroundColor( palette().active().button() );
QPushButton::paintEvent( e );
}
else
{
- // custom drawing of unhovered button
QPainter p( this );
- setPaletteBackgroundColor( palette().active().background() );
+ p.fillRect(e->rect(), parentWidget() ? \
parentWidget()->palette().brush(QPalette::Active, QColorGroup::Background) \
: paletteBackgroundColor()); drawButtonLabel( &p );
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic