diff options
-rw-r--r-- | examples/themes/metal.cpp | 16 | ||||
-rw-r--r-- | examples/themes/metal.h | 16 | ||||
-rw-r--r-- | examples/themes/wood.cpp | 22 | ||||
-rw-r--r-- | examples/themes/wood.h | 22 | ||||
-rw-r--r-- | src/kernel/qstyle.cpp | 21 |
5 files changed, 53 insertions, 44 deletions
diff --git a/examples/themes/metal.cpp b/examples/themes/metal.cpp index 8d6bdf593..c3815c625 100644 --- a/examples/themes/metal.cpp +++ b/examples/themes/metal.cpp @@ -41,7 +41,7 @@ MetalStyle::MetalStyle() : TQWindowsStyle() { } /*! Reimplementation from TQStyle */ -void MetalStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void MetalStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { oldPalette = ceData.palette; @@ -99,7 +99,7 @@ void MetalStyle::applicationPolish( TQStyleControlElementData ceData, ControlEle /*! Reimplementation from TQStyle */ -void MetalStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void MetalStyle::applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(oldPalette, TRUE)); applicationActionRequest(ceData, elementFlags, ptr, AAR_SetFont, TQStyleApplicationActionRequestData(ceData.font, TRUE)); @@ -108,7 +108,7 @@ void MetalStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlE /*! Reimplementation from TQStyle */ -void MetalStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void MetalStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { // the polish function sets some widgets to transparent mode and // some to translate background mode in order to get the full @@ -126,7 +126,7 @@ void MetalStyle::polish( TQStyleControlElementData ceData, ControlElementFlags e } } -void MetalStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void MetalStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { // the polish function sets some widgets to transparent mode and // some to translate background mode in order to get the full @@ -145,7 +145,7 @@ void MetalStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags void MetalStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -191,7 +191,7 @@ void MetalStyle::drawPrimitive( PrimitiveElement pe, void MetalStyle::drawControl( ControlElement element, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -292,7 +292,7 @@ void MetalStyle::drawControl( ControlElement element, } void MetalStyle::drawComplexControl( ComplexControl cc, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -468,7 +468,7 @@ void MetalStyle::drawMetalGradient( TQPainter *p, int x, int y, int w, int h, -int MetalStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *w ) const +int MetalStyle::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *w ) const { switch ( metric ) { case PM_MenuBarFrameWidth: diff --git a/examples/themes/metal.h b/examples/themes/metal.h index d90cb36db..6ff38d300 100644 --- a/examples/themes/metal.h +++ b/examples/themes/metal.h @@ -26,14 +26,14 @@ class MetalStyle : public TQWindowsStyle { public: MetalStyle(); - void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); void drawPrimitive( PrimitiveElement pe, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -42,7 +42,7 @@ public: void drawControl( ControlElement element, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -52,7 +52,7 @@ public: void drawComplexControl( ComplexControl cc, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -61,7 +61,7 @@ public: SCFlags subActive = SC_None, const TQStyleOption& = TQStyleOption::Default, const TQWidget *widget = 0 ) const; - int pixelMetric( PixelMetric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const; + int pixelMetric( PixelMetric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const; private: diff --git a/examples/themes/wood.cpp b/examples/themes/wood.cpp index cbd6aab6d..dd1002bbf 100644 --- a/examples/themes/wood.cpp +++ b/examples/themes/wood.cpp @@ -769,7 +769,7 @@ NorwegianWoodStyle::NorwegianWoodStyle() : TQWindowsStyle() /*! Reimplementation from TQStyle */ -void NorwegianWoodStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void NorwegianWoodStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { oldPalette = ceData.palette; @@ -871,7 +871,7 @@ void NorwegianWoodStyle::applicationPolish( TQStyleControlElementData ceData, Co applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(TQPalette(active, disabled, active), TRUE)); } -void NorwegianWoodStyle::applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void NorwegianWoodStyle::applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { applicationActionRequest(ceData, elementFlags, ptr, AAR_SetPalette, TQStyleApplicationActionRequestData(oldPalette, TRUE)); } @@ -879,7 +879,7 @@ void NorwegianWoodStyle::applicationUnPolish( TQStyleControlElementData ceData, /*! Reimplementation from TQStyle */ -void NorwegianWoodStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void NorwegianWoodStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { // the polish function sets some widgets to transparent mode and // some to translate background mode in order to get the full @@ -896,7 +896,7 @@ void NorwegianWoodStyle::polish( TQStyleControlElementData ceData, ControlElemen } } -void NorwegianWoodStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) +void NorwegianWoodStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) { // the polish function sets some widgets to transparent mode and // some to translate background mode in order to get the full @@ -915,7 +915,7 @@ void NorwegianWoodStyle::unPolish( TQStyleControlElementData ceData, ControlElem void NorwegianWoodStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -986,7 +986,7 @@ void NorwegianWoodStyle::drawPrimitive( PrimitiveElement pe, void NorwegianWoodStyle::drawControl( ControlElement element, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -1095,7 +1095,7 @@ void NorwegianWoodStyle::drawControl( ControlElement element, void NorwegianWoodStyle::drawControlMask( ControlElement element, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQStyleOption& opt, @@ -1118,7 +1118,7 @@ void NorwegianWoodStyle::drawControlMask( ControlElement element, void NorwegianWoodStyle::drawComplexControl( ComplexControl cc, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -1192,7 +1192,7 @@ void NorwegianWoodStyle::drawComplexControlMask( ComplexControl control, } TQRect NorwegianWoodStyle::querySubControlMetrics( ComplexControl control, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl sc, const TQStyleOption& opt, @@ -1250,7 +1250,7 @@ TQRect NorwegianWoodStyle::querySubControlMetrics( ComplexControl control, return rect; } -TQRect NorwegianWoodStyle::subRect( SubRect sr, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget * widget ) const +TQRect NorwegianWoodStyle::subRect( SubRect sr, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget * widget ) const { TQRect r; switch ( sr ) { @@ -1355,7 +1355,7 @@ static void get_combo_parameters( const TQRect &r, static inline int buttonthickness( int d ) { return d > 20 ? 5 : ( d < 10 ? 2: 3 ); } -void NorwegianWoodStyle::drawSemicircleButton( TQPainter *p, TQStyleControlElementData ceData, +void NorwegianWoodStyle::drawSemicircleButton( TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, int dir, bool sunken, const TQColorGroup &g ) const diff --git a/examples/themes/wood.h b/examples/themes/wood.h index a572e24bb..3c2343704 100644 --- a/examples/themes/wood.h +++ b/examples/themes/wood.h @@ -26,14 +26,14 @@ class NorwegianWoodStyle : public TQWindowsStyle { public: NorwegianWoodStyle(); - void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); - void applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); void drawPrimitive( PrimitiveElement pe, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -42,7 +42,7 @@ public: void drawControl( ControlElement element, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -52,7 +52,7 @@ public: void drawControlMask( ControlElement element, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQStyleOption& = TQStyleOption::Default, @@ -60,7 +60,7 @@ public: void drawComplexControl( ComplexControl cc, TQPainter *p, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, @@ -79,17 +79,17 @@ public: const TQWidget *widget = 0 ) const; TQRect querySubControlMetrics( ComplexControl control, - TQStyleControlElementData ceData, + const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl sc, const TQStyleOption& = TQStyleOption::Default, const TQWidget *widget = 0 ) const; - TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; private: - void drawSemicircleButton(TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, int dir, + void drawSemicircleButton(TQPainter *p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &r, int dir, bool sunken, const TQColorGroup &g ) const; TQPalette oldPalette; TQPixmap *sunkenDark; diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 8529305dd..9960e1d33 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -2355,12 +2355,21 @@ bool TQStyle::eventFilter(TQObject *o, TQEvent *e) { ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o]; bool ret; TQWidget* w = dynamic_cast<TQWidget*>(o); - if ((w) && (e->type() == TQEvent::Paint)) { - TQPainter p(w); - TQPainter* activePainterOrig = ceData.activePainter; - const_cast<TQStyleControlElementData&>(ceData).activePainter = &p; - ret = handler->objectEventHandler(ceData, elementFlags, o, e); - const_cast<TQStyleControlElementData&>(ceData).activePainter = activePainterOrig; + if (w) { + // Update ceData as widget parameters may have changed + // If not done glitches may appear such as those present in Bug 1816 + populateControlElementDataFromWidget(w, TQStyleOption()); + const TQStyleControlElementData &widgetCEData = *(w->controlElementDataObject()); + if (e->type() == TQEvent::Paint) { + TQPainter p(w); + TQPainter* activePainterOrig = widgetCEData.activePainter; + const_cast<TQStyleControlElementData&>(widgetCEData).activePainter = &p; + ret = handler->objectEventHandler(widgetCEData, elementFlags, o, e); + const_cast<TQStyleControlElementData&>(widgetCEData).activePainter = activePainterOrig; + } + else { + ret = handler->objectEventHandler(widgetCEData, elementFlags, o, e); + } } else { ret = handler->objectEventHandler(ceData, elementFlags, o, e); |