diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/qstyle.cpp | 88 | ||||
-rw-r--r-- | src/kernel/qstyle.h | 76 | ||||
-rw-r--r-- | src/kernel/qwidget.cpp | 13 | ||||
-rw-r--r-- | src/kernel/qwidget.h | 2 |
4 files changed, 98 insertions, 81 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 75d448d..c7f4ef4 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -54,7 +54,6 @@ #include <limits.h> - class QStylePrivate { public: @@ -495,7 +494,7 @@ void QStyle::unPolish( QWidget *widget ) { \sa unPolish() */ -void QStyle::polish( QStyleControlElementData ceData, ControlElementFlags, void *ptr ) { +void QStyle::polish( const QStyleControlElementData &ceData, ControlElementFlags, void *ptr ) { if (ceData.widgetObjectTypes.contains("QWidget")) { // Enable dynamic hide/show of accelerator shortcuts QWidget* widget = reinterpret_cast<QWidget*>(ptr); @@ -513,7 +512,7 @@ void QStyle::polish( QStyleControlElementData ceData, ControlElementFlags, void \sa polish() */ -void QStyle::unPolish( QStyleControlElementData ceData, ControlElementFlags, void *ptr ) { +void QStyle::unPolish( const QStyleControlElementData &ceData, ControlElementFlags, void *ptr ) { if (ceData.widgetObjectTypes.contains("QWidget")) { // Disable dynamic hide/show of accelerator shortcuts QWidget* widget = reinterpret_cast<QWidget*>(ptr); @@ -555,7 +554,7 @@ void QStyle::unPolish( QApplication *app ) { \sa unPolish() */ -void QStyle::applicationPolish( QStyleControlElementData, ControlElementFlags, void * ) { +void QStyle::applicationPolish( const QStyleControlElementData&, ControlElementFlags, void * ) { // } @@ -571,7 +570,7 @@ void QStyle::applicationPolish( QStyleControlElementData, ControlElementFlags, v \sa polish() */ -void QStyle::applicationUnPolish( QStyleControlElementData, ControlElementFlags, void * ) { +void QStyle::applicationUnPolish( const QStyleControlElementData&, ControlElementFlags, void * ) { // } @@ -605,7 +604,7 @@ void QStyle::polishPopupMenu( QPopupMenu *pm ) { (\l{QPopupMenu::setMouseTracking()}) and whether the menu is checkable by default (\l{QPopupMenu::setCheckable()}). */ -void QStyle::polishPopupMenu( QStyleControlElementData, ControlElementFlags, void * ) +void QStyle::polishPopupMenu( const QStyleControlElementData&, ControlElementFlags, void * ) { } @@ -909,7 +908,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn void QStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption& opt) const + \fn void QStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption& opt) const Draws the style PrimitiveElement \a pe using the painter \a p in the area \a r. Colors are used from the color group \a cg. @@ -1042,7 +1041,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn void QStyle::drawControl( ControlElement element, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, const QStyleOption& opt, const QWidget *widget) const + \fn void QStyle::drawControl( ControlElement element, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, const QStyleOption& opt, const QWidget *widget) const Draws the ControlElement \a element using the painter \a p in the area \a r. Colors are used from the color group \a cg. @@ -1201,7 +1200,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn void QStyle::drawControlMask( ControlElement element, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const + \fn void QStyle::drawControlMask( ControlElement element, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const Draw a bitmask for the ControlElement \a element using the painter \a p in the area \a r. See drawControl() for an explanation of the @@ -1274,7 +1273,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn QRect QStyle::subRect( SubRect subrect, const QStyleControlElementData ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const; + \fn QRect QStyle::subRect( SubRect subrect, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const; Returns the sub-area \a subrect for the \a widget in logical coordinates. @@ -1406,7 +1405,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn void QStyle::drawComplexControl( ComplexControl control, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption& opt, const QWidget *widget ) const + \fn void QStyle::drawComplexControl( ComplexControl control, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption& opt, const QWidget *widget ) const Draws the ComplexControl \a control using the painter \a p in the area \a r. Colors are used from the color group \a cg. The \a sub @@ -1504,7 +1503,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn void QStyle::drawComplexControlMask( ComplexControl control, QPainter *p, const QStyleControlElementData ceData, const ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const + \fn void QStyle::drawComplexControlMask( ComplexControl control, QPainter *p, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const Draw a bitmask for the ComplexControl \a control using the painter \a p in the area \a r. See drawComplexControl() for an explanation @@ -1524,7 +1523,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn QRect QStyle::querySubControlMetrics( ComplexControl control, QStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl subcontrol, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; + \fn QRect QStyle::querySubControlMetrics( ComplexControl control, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl subcontrol, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; Returns the rect for the SubControl \a subcontrol for \a widget in logical coordinates. @@ -1546,7 +1545,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn SubControl QStyle::querySubControl( ComplexControl control, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QPoint &pos, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; + \fn SubControl QStyle::querySubControl( ComplexControl control, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QPoint &pos, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; Returns the SubControl for \a widget at the point \a pos. The \a widget argument is a pointer to a QWidget or one of its @@ -1672,7 +1671,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn int QStyle::pixelMetric( PixelMetric metric, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QWidget *widget = 0 ) const; + \fn int QStyle::pixelMetric( PixelMetric metric, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QWidget *widget = 0 ) const; Returns the pixel metric for \a metric. @@ -1734,7 +1733,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn QSize QStyle::sizeFromContents( ContentsType contents, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QSize &contentsSize, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; + \fn QSize QStyle::sizeFromContents( ContentsType contents, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QSize &contentsSize, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; Returns the size of \a widget based on the contents size \a contentsSize. @@ -1924,7 +1923,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn int QStyle::styleHint( StyleHint stylehint, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption &opt = QStyleOption::Default, QStyleHintReturn *returnData = 0, const QWidget *widget = 0 ) const; + \fn int QStyle::styleHint( StyleHint stylehint, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QStyleOption &opt = QStyleOption::Default, QStyleHintReturn *returnData = 0, const QWidget *widget = 0 ) const; Returns the style hint \a stylehint for \a widget. Currently, \a widget, \a opt, and \a returnData are unused; they're included to @@ -1971,7 +1970,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, */ /*! - \fn QPixmap QStyle::stylePixmap( StylePixmap stylepixmap, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; + \fn QPixmap QStyle::stylePixmap( StylePixmap stylepixmap, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const; Returns a pixmap for \a stylepixmap. @@ -2011,7 +2010,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r, function is provided to aid style implementors in supporting right-to-left mode. - Note that this function is deprecated in favor of visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags ); + Note that this function is deprecated in favor of visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags ); \sa QApplication::reverseLayout() */ @@ -2023,7 +2022,7 @@ QRect QStyle::visualRect( const QRect &logical, const QWidget *w ) } /*! - \fn QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags ); + \fn QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags ); Returns the rect \a logical in screen coordinates. The bounding rect for the widget described by \a ceData and \a elementFlags @@ -2033,7 +2032,7 @@ QRect QStyle::visualRect( const QRect &logical, const QWidget *w ) \sa QApplication::reverseLayout() */ -QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags ) +QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags ) { Q_UNUSED(elementFlags) @@ -2065,15 +2064,15 @@ QRect QStyle::visualRect( const QRect &logical, const QRect &boundingRect ) } /*! - \fn void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); + \fn void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); Intercepts events generated by \a source and sends them to \a handler via - the bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) virtual method. + the bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) virtual method. \sa void QStyle::removeObjectEventHandler( QObject* source, QStyle* handler ) - \sa bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) + \sa bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) */ -void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) { +void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) { bool cbret = false; if (m_eventHandlerInstallationHook) { cbret = (*m_eventHandlerInstallationHook)(ceData, elementFlags, source, handler); @@ -2090,13 +2089,13 @@ void QStyle::installObjectEventHandler( QStyleControlElementData ceData, Control } /*! - \fn void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); + \fn void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); Stops intercepting events generated by \a source. - \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) */ -void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) { +void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) { bool cbret = false; if (m_eventHandlerRemovalHook) { cbret = (*m_eventHandlerRemovalHook)(ceData, elementFlags, source, handler); @@ -2117,9 +2116,9 @@ void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlE Sets a callback function \a hook which will be called whenever a new intercept request is made via the QStyle::installObjectEventHandler method. The callback function must - use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). + use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). - \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) */ void QStyle::setEventHandlerInstallationHook( EventHandlerInstallationHook hook ) { m_eventHandlerInstallationHook = hook; @@ -2130,24 +2129,24 @@ void QStyle::setEventHandlerInstallationHook( EventHandlerInstallationHook hook Sets a callback function \a hook which will be called whenever a new intercept deactivation request is made via the QStyle::removeObjectEventHandler method. The callback function must - use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). + use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). - \sa void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) */ void QStyle::setEventHandlerRemovalHook( EventHandlerRemovalHook hook ) { m_eventHandlerRemovalHook = hook; } /*! - \fn bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ); + \fn bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ); Override this virtual function to intercept events requested by a previous call to QStyle::installObjectEventHandler. - \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) - \sa void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) */ -bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) { +bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) { Q_UNUSED(ceData); Q_UNUSED(elementFlags); Q_UNUSED(source); @@ -2193,20 +2192,20 @@ bool QStyle::eventFilter(QObject *o, QEvent *e) { Sets a callback function \a hook which will be called whenever a new widget action request is made via the QStyle::installObjectEventHandler method. The callback function must - use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). + use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). - \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) */ void QStyle::setWidgetActionRequestHook( WidgetActionRequestHook hook ) { m_widgetActionRequestHook = hook; } /*! - \fn bool widgetActionRequestHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request ); + \fn bool widgetActionRequestHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request ); Handles widget action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing. */ -bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData ) { +bool QStyle::widgetActionRequest( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData ) { bool cbret = false; if (m_widgetActionRequestHook) { cbret = (*m_widgetActionRequestHook)(ceData, elementFlags, source, request, requestData); @@ -2327,20 +2326,20 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen Sets a callback function \a hook which will be called whenever a new application action request is made via the QStyle::installObjectEventHandler method. The callback function must - use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). + use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ). - \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) + \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) */ void QStyle::setApplicationActionRequestHook( ApplicationActionRequestHook hook ) { m_applicationActionRequestHook = hook; } /*! - \fn bool applicationActionRequestHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request ); + \fn bool applicationActionRequestHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request ); Handles application action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing. */ -bool QStyle::applicationActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData ) { +bool QStyle::applicationActionRequest( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData ) { bool cbret = false; if (m_applicationActionRequestHook) { cbret = (*m_applicationActionRequestHook)(ceData, elementFlags, source, request, requestData); @@ -2609,6 +2608,7 @@ QPixmap QStyle::stylePixmap(StylePixmap sp, const QWidget *w, const QStyleOption */ QStyleControlElementData::QStyleControlElementData() { + isNull = true; activePainter = 0; tickMarkSetting = 0; comboBoxLineEditFlags = 0; diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h index 63acec6..cf7a235 100644 --- a/src/kernel/qstyle.h +++ b/src/kernel/qstyle.h @@ -228,6 +228,10 @@ class QStyleControlElementTabBarData { class Q_EXPORT QStyleControlElementData { public: + QStyleControlElementData(); + + public: + bool isNull; QStringList widgetObjectTypes; bool allDataPopulated; Qt::WFlags wflags; @@ -286,9 +290,6 @@ class Q_EXPORT QStyleControlElementData { QString caption; QStyleControlElementGenericWidgetData topLevelWidgetData; Q_UINT32 topLevelWidgetFlags; - - public: - QStyleControlElementData(); }; class Q_EXPORT QStyleWidgetActionRequestData { @@ -360,28 +361,28 @@ public: virtual void polish( QWidget * ); // New API - virtual void polish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + virtual void polish( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); // Old API // DEPRECATED virtual void unPolish( QWidget * ); // New API - virtual void unPolish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + virtual void unPolish( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); // Old API // DEPRECATED virtual void polish( QApplication * ); // New API - virtual void applicationPolish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + virtual void applicationPolish( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); // Old API // DEPRECATED virtual void unPolish( QApplication * ); // New API - virtual void applicationUnPolish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * ); + virtual void applicationUnPolish( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); virtual void polish( QPalette & ); @@ -390,7 +391,7 @@ public: virtual void polishPopupMenu( QPopupMenu* ); // New API - virtual void polishPopupMenu( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * ) = 0; + virtual void polishPopupMenu( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ) = 0; virtual QRect itemRect( QPainter *p, const QRect &r, int flags, bool enabled, @@ -521,7 +522,7 @@ public: // New API virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, @@ -576,7 +577,7 @@ public: // New API virtual void drawControl( ControlElement element, QPainter *p, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, @@ -595,7 +596,7 @@ public: // New API virtual void drawControlMask( ControlElement element, QPainter *p, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QStyleOption& = QStyleOption::Default, @@ -646,7 +647,7 @@ public: virtual QRect subRect( SubRect r, const QWidget *widget ) const; // New API - virtual QRect subRect( SubRect r, const QStyleControlElementData ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const = 0; + virtual QRect subRect( SubRect r, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const = 0; enum ComplexControl{ @@ -728,7 +729,7 @@ public: virtual void drawComplexControl( ComplexControl control, QPainter *p, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, @@ -753,7 +754,7 @@ public: // New API virtual void drawComplexControlMask( ComplexControl control, QPainter *p, - const QStyleControlElementData ceData, + const QStyleControlElementData &ceData, const ControlElementFlags elementFlags, const QRect &r, const QStyleOption& = QStyleOption::Default, @@ -768,7 +769,7 @@ public: // New API virtual QRect querySubControlMetrics( ComplexControl control, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl sc, const QStyleOption& = QStyleOption::Default, @@ -783,7 +784,7 @@ public: // New API virtual SubControl querySubControl( ComplexControl control, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QPoint &pos, const QStyleOption& = QStyleOption::Default, @@ -872,7 +873,7 @@ public: // New API virtual int pixelMetric( PixelMetric metric, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QWidget *widget = 0 ) const = 0; @@ -909,7 +910,7 @@ public: const QStyleOption& = QStyleOption::Default ) const; virtual QSize sizeFromContents( ContentsType contents, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QSize &contentsSize, const QStyleOption& = QStyleOption::Default, @@ -1083,7 +1084,7 @@ public: // New API virtual int styleHint( StyleHint stylehint, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QStyleOption& = QStyleOption::Default, QStyleHintReturn* returnData = 0, @@ -1115,7 +1116,7 @@ public: const QStyleOption& = QStyleOption::Default ) const; virtual QPixmap stylePixmap( StylePixmap stylepixmap, - QStyleControlElementData ceData, + const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QStyleOption& = QStyleOption::Default, const QWidget *widget = 0 ) const = 0; @@ -1126,7 +1127,7 @@ public: static QRect visualRect( const QRect &logical, const QWidget *w ); // New API - static QRect visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags ); + static QRect visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags ); static QRect visualRect( const QRect &logical, const QRect &bounding ); @@ -1135,13 +1136,13 @@ public: typedef QMap<void*, QStyle*> ObjectEventSourceToHandlerMap; typedef QMap<void*, QStyleControlElementData> ObjectEventSourceDataToHandlerMap; typedef QMap<void*, ControlElementFlags> ObjectEventSourceFlagsToHandlerMap; - typedef bool (*EventHandlerInstallationHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler); - typedef bool (*EventHandlerRemovalHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler); - void installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); - void removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); + typedef bool (*EventHandlerInstallationHook)(const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler); + typedef bool (*EventHandlerRemovalHook)(const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler); + void installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); + void removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ); void setEventHandlerInstallationHook( EventHandlerInstallationHook ); void setEventHandlerRemovalHook( EventHandlerRemovalHook hook ); - virtual bool objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ); + virtual bool objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ); enum WidgetActionRequest { WAR_Repaint, @@ -1165,37 +1166,40 @@ public: WAR_SendPaintEvent }; - typedef bool (*WidgetActionRequestHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData); + typedef bool (*WidgetActionRequestHook)(const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData); void setWidgetActionRequestHook( WidgetActionRequestHook ); - virtual bool widgetActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData = QStyleWidgetActionRequestData() ); + virtual bool widgetActionRequest( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData = QStyleWidgetActionRequestData() ); enum ApplicationActionRequest { AAR_SetPalette, AAR_SetFont }; - typedef bool (*ApplicationActionRequestHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData); + typedef bool (*ApplicationActionRequestHook)(const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData); void setApplicationActionRequestHook( ApplicationActionRequestHook ); - virtual bool applicationActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData = QStyleApplicationActionRequestData() ); + virtual bool applicationActionRequest( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData = QStyleApplicationActionRequestData() ); // Old 2.x QStyle API #ifndef QT_NO_COMPAT int defaultFrameWidth() const { - return pixelMetric( PM_DefaultFrameWidth, QStyleControlElementData(), CEF_None ); + QStyleControlElementData ceData; + return pixelMetric( PM_DefaultFrameWidth, ceData, CEF_None ); } void tabbarMetrics( const QWidget* t, int& hf, int& vf, int& ov ) const { - hf = pixelMetric( PM_TabBarTabHSpace, QStyleControlElementData(), CEF_None, t ); - vf = pixelMetric( PM_TabBarTabVSpace, QStyleControlElementData(), CEF_None, t ); - ov = pixelMetric( PM_TabBarBaseOverlap, QStyleControlElementData(), CEF_None, t ); + QStyleControlElementData ceData; + hf = pixelMetric( PM_TabBarTabHSpace, ceData, CEF_None, t ); + vf = pixelMetric( PM_TabBarTabVSpace, ceData, CEF_None, t ); + ov = pixelMetric( PM_TabBarBaseOverlap, ceData, CEF_None, t ); } QSize scrollBarExtent() const { - return QSize(pixelMetric(PM_ScrollBarExtent, QStyleControlElementData(), CEF_None), - pixelMetric(PM_ScrollBarExtent, QStyleControlElementData(), CEF_None)); + QStyleControlElementData ceData; + return QSize(pixelMetric(PM_ScrollBarExtent, ceData, CEF_None), + pixelMetric(PM_ScrollBarExtent, ceData, CEF_None)); } #endif diff --git a/src/kernel/qwidget.cpp b/src/kernel/qwidget.cpp index 28328b8..704681d 100644 --- a/src/kernel/qwidget.cpp +++ b/src/kernel/qwidget.cpp @@ -1184,6 +1184,9 @@ void QWidget::createExtra() #endif extra->size_policy = QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + + extra->m_ceData = NULL; + createSysExtra(); } } @@ -3591,7 +3594,15 @@ bool QWidget::isActiveWindow() const if(tlw == qApp->activeWindow() || ( isVisible() && tlw->isPopup() )) return TRUE; #ifndef QT_NO_STYLE - if(style().styleHint(QStyle::SH_Widget_ShareActivation, this )) { + const_cast<QWidget*>(this)->createExtra(); + if (!extra->m_ceData) { + const_cast<QWidget*>(this)->extra->m_ceData = new QStyleControlElementData(); + } + //extra->m_ceData->widgetObjectTypes = getObjectTypeListForObject(this); + extra->m_ceData->widgetObjectTypes.clear(); + extra->m_ceData->allDataPopulated = false; + //if(style().styleHint(QStyle::SH_Widget_ShareActivation, *extra->m_ceData, getControlElementFlagsForObject(this, extra->m_ceData->widgetObjectTypes, QStyleOption(), false), QStyleOption(), NULL, this)) { + if(style().styleHint(QStyle::SH_Widget_ShareActivation, *extra->m_ceData, QStyle::CEF_None, QStyleOption(), NULL, this)) { if((tlw->isDialog() || (tlw->testWFlags(Qt::WStyle_Tool) && !tlw->isPopup())) && !tlw->testWFlags(Qt::WShowModal) && (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow())) diff --git a/src/kernel/qwidget.h b/src/kernel/qwidget.h index 9df9710..44bb24e 100644 --- a/src/kernel/qwidget.h +++ b/src/kernel/qwidget.h @@ -63,6 +63,7 @@ class QFocusData; class QCursor; class QWSRegionManager; class QStyle; +class QStyleControlElementData; class Q_EXPORT QWidget : public QObject, public QPaintDevice { @@ -1086,6 +1087,7 @@ struct Q_EXPORT QWExtra { #endif QRect micro_focus_hint; // micro focus hint QSizePolicy size_policy; + QStyleControlElementData* m_ceData; }; #define Q_DEFINED_QWIDGET |