diff options
author | Timothy Pearson <[email protected]> | 2012-10-16 16:02:16 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-10-16 16:02:16 -0500 |
commit | 2ed8f9ade70bd38a541d7e62e02962a1311aabb5 (patch) | |
tree | e369c4e00f3e1b2b112c3282293290d9dc6441a1 /kstyles/highcolor | |
parent | a151a4d477b5f9948ada98155ea9bcca7973748f (diff) | |
download | tdelibs-2ed8f9ade70bd38a541d7e62e02962a1311aabb5.tar.gz tdelibs-2ed8f9ade70bd38a541d7e62e02962a1311aabb5.zip |
Use internal Qt hover widget drawing
Diffstat (limited to 'kstyles/highcolor')
-rw-r--r-- | kstyles/highcolor/highcolor.cpp | 38 | ||||
-rw-r--r-- | kstyles/highcolor/highcolor.h | 1 |
2 files changed, 15 insertions, 24 deletions
diff --git a/kstyles/highcolor/highcolor.cpp b/kstyles/highcolor/highcolor.cpp index bd17b3dfc..06de67bd6 100644 --- a/kstyles/highcolor/highcolor.cpp +++ b/kstyles/highcolor/highcolor.cpp @@ -179,7 +179,6 @@ HighColorStyle::HighColorStyle( StyleType styleType ) type = styleType; highcolor = (type == HighColor && TQPixmap::defaultDepth() > 8); gDict.setAutoDelete(true); - hoverWidget = 0L; selectionBackground = false; } @@ -1121,9 +1120,6 @@ void HighColorStyle::drawControl( TQ_ControlElement element, // PUSHBUTTON // ------------------------------------------------------------------- case CE_PushButton: { - if ( widget == hoverWidget ) - flags |= Style_MouseOver; - if ( type != HighColor ) { TQPushButton *button = (TQPushButton*) widget; TQRect br = r; @@ -1971,31 +1967,22 @@ bool HighColorStyle::objectEventHandler( TQStyleControlElementData ceData, Contr if (KStyle::objectEventHandler( ceData, elementFlags, source, event )) return true; - if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { + TQToolBar* toolbar; + + if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) + { TQObject* object = reinterpret_cast<TQObject*>(source); - TQToolBar* toolbar; - - // Handle push button hover effects. - TQPushButton* button = dynamic_cast<TQPushButton*>(object); - if ( button ) - { - if ( (event->type() == TQEvent::Enter) && - (button->isEnabled()) ) { - hoverWidget = button; - button->repaint( false ); - } - else if ( (event->type() == TQEvent::Leave) && - (TQT_BASE_OBJECT(object) == TQT_BASE_OBJECT(hoverWidget)) ) { - hoverWidget = 0L; - button->repaint( false ); - } - } else if ( object->parent() && !qstrcmp( object->name(), kdeToolbarWidget ) ) + if ( object->parent() && !qstrcmp( object->name(), kdeToolbarWidget ) ) { // Draw a gradient background for custom widgets in the toolbar // that have specified a "kde toolbar widget" name. + // FIXME + // This currently requires direct widget access + // Is there any way to do this without it? if (event->type() == TQEvent::Paint ) { + // Find the top-level toolbar of this widget, since it may be nested in other // widgets that are on the toolbar. TQWidget *widget = TQT_TQWIDGET(object); @@ -2023,11 +2010,16 @@ bool HighColorStyle::objectEventHandler( TQStyleControlElementData ceData, Contr return false; // Now draw the contents } } else if ( object->parent() && - (toolbar = dynamic_cast<TQToolBar*>(object->parent())) ) + (toolbar = dynamic_cast<TQToolBar*>(object->parent())) ) { // We need to override the paint event to draw a // gradient on a QToolBarExtensionWidget. + // FIXME + // This currently requires direct widget access + // Is there any way to do this without it? + if ( event->type() == TQEvent::Paint ) { + TQWidget *widget = TQT_TQWIDGET(object); TQRect wr = widget->rect(), tr = toolbar->rect(); TQPainter p( widget ); diff --git a/kstyles/highcolor/highcolor.h b/kstyles/highcolor/highcolor.h index 043441f95..461902403 100644 --- a/kstyles/highcolor/highcolor.h +++ b/kstyles/highcolor/highcolor.h @@ -171,7 +171,6 @@ class HighColorStyle : public KStyle int pwidth=-1, int pheight=-1 ) const; - TQWidget *hoverWidget; StyleType type; bool highcolor; mutable bool selectionBackground; |