From 2ed8f9ade70bd38a541d7e62e02962a1311aabb5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 16 Oct 2012 16:02:16 -0500 Subject: Use internal Qt hover widget drawing --- kstyles/highcolor/highcolor.cpp | 38 +++++++++++++++----------------------- kstyles/highcolor/highcolor.h | 1 - 2 files changed, 15 insertions(+), 24 deletions(-) (limited to 'kstyles/highcolor') 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(source); - TQToolBar* toolbar; - - // Handle push button hover effects. - TQPushButton* button = dynamic_cast(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(object->parent())) ) + (toolbar = dynamic_cast(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; -- cgit v1.2.1