From f209ff4b488f2ea3fa39bbed57dbbb8fe0162a3b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 16 Oct 2012 15:39:47 -0500 Subject: Move hover widget code into the Qt core instead of the styles This more closely matches other widget toolkits such as GTK --- src/kernel/qapplication.cpp | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'src/kernel/qapplication.cpp') diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 7296f4c..0478cf1 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -2557,6 +2557,21 @@ bool QApplication::event( QEvent *e ) return QObject::event(e); } +#define HOVER_SENSITIVE_WIDGET_SELECT if ( widget->inherits("QPushButton") \ + || widget->inherits("QComboBox") \ + || widget->inherits("QSpinWidget") \ + || widget->inherits("QCheckBox") \ + || widget->inherits("QRadioButton") \ + || widget->inherits("QToolButton") \ + || widget->inherits("QSlider") \ + || widget->inherits("QScrollBar") \ + || widget->inherits("QTabBar") \ + || widget->inherits("QDockWindowHandle") \ + || widget->inherits("QSplitterHandle") ) + +#define FOCUS_SENSITIVE_WIDGET_SELECT if ( widget->inherits("QLineEdit") ) +#define FOCUS_SENSITIVE_PARENT_WIDGET_SELECT if ( widget->parentWidget() && widget->parentWidget()->inherits("QSpinWidget") ) + /*!\internal Helper function called by notify() @@ -2579,10 +2594,28 @@ bool QApplication::internalNotify( QObject *receiver, QEvent * e) QWidget *widget = (QWidget*)receiver; // toggle HasMouse widget state on enter and leave - if ( e->type() == QEvent::Enter || e->type() == QEvent::DragEnter ) + if ( e->type() == QEvent::Enter || e->type() == QEvent::DragEnter ) { widget->setWState( WState_HasMouse ); - else if ( e->type() == QEvent::Leave || e->type() == QEvent::DragLeave ) + HOVER_SENSITIVE_WIDGET_SELECT { + widget->repaint(false); + } + } + else if ( e->type() == QEvent::Leave || e->type() == QEvent::DragLeave ) { widget->clearWState( WState_HasMouse ); + HOVER_SENSITIVE_WIDGET_SELECT { + widget->repaint(false); + } + } + + // repaint information entry widgets on focus set/unset + if ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut ) { + FOCUS_SENSITIVE_WIDGET_SELECT { + widget->repaint(false); + } + FOCUS_SENSITIVE_PARENT_WIDGET_SELECT { + widget->parentWidget()->repaint(false); + } + } // throw away any mouse-tracking-only mouse events if ( e->type() == QEvent::MouseMove && -- cgit v1.2.3