[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. 031dfa411daabf8703a83cc3a788ab35f3ac469c

George Kiagiadakis gkiagia-guest at alioth.debian.org
Sat Feb 28 17:17:47 UTC 2009


The following commit has been merged in the master branch:
commit 031dfa411daabf8703a83cc3a788ab35f3ac469c
Author: George Kiagiadakis <gkiagia at users.sourceforge.net>
Date:   Sat Feb 28 19:15:29 2009 +0200

    Implement a proper QHoverEvent handler. This fixes the high cpu usage of RichRadioButton.

diff --git a/richradiobutton.cpp b/richradiobutton.cpp
index d90d104..c85f6d8 100644
--- a/richradiobutton.cpp
+++ b/richradiobutton.cpp
@@ -112,6 +112,7 @@ void RichRadioButton::Private::init(RichRadioButton *q)
 
     q->setCheckable(true);
     q->setAutoExclusive(true);
+    q->setAttribute(Qt::WA_Hover);
 }
 
 
@@ -139,8 +140,19 @@ void RichRadioButton::setText(const QString & text)
     QAbstractButton::setText(text);
 }
 
+bool RichRadioButton::event(QEvent *event)
+{
+    switch (event->type()) {
+        case QEvent::HoverEnter:
+        case QEvent::HoverLeave:
+            d->m_button->update();
+            return true;
+        default:
+            return QAbstractButton::event(event);
+    }
+}
+
 void RichRadioButton::paintEvent(QPaintEvent *event)
 {
-    d->m_button->update(); //this is for reacting in hover events.
     QWidget::paintEvent(event);
 }
diff --git a/richradiobutton.h b/richradiobutton.h
index d03841f..af2b578 100644
--- a/richradiobutton.h
+++ b/richradiobutton.h
@@ -31,6 +31,7 @@ public:
     void setText(const QString & text);
 
 protected:
+    virtual bool event(QEvent *event);
     //reimplemented because it's pure virtual in QAbstractButton
     virtual void paintEvent(QPaintEvent *event);
 

-- 
Kaboom - Debian KDE 3->4 migration tool



More information about the pkg-kde-commits mailing list