diff options
Diffstat (limited to 'src/kernel/qstyle.cpp')
-rw-r--r-- | src/kernel/qstyle.cpp | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 1d085f3..55aba9e 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -403,6 +403,7 @@ QStyle::QStyle() m_eventHandlerInstallationHook = NULL; m_eventHandlerRemovalHook = NULL; m_widgetActionRequestHook = NULL; + m_applicationActionRequestHook = NULL; conditionalAcceleratorsEnabled = false; d = new QStylePrivate; } @@ -526,8 +527,7 @@ void QStyle::unPolish( QStyleControlElementData ceData, ControlElementFlags, voi \sa unPolish() */ void QStyle::polish( QApplication *app ) { - QStyleControlElementData ceData; - ceData.widgetObjectTypes = getObjectTypeListForObject(app); + QStyleControlElementData ceData = populateControlElementDataFromApplication(app, QStyleOption()); applicationPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, QStyleOption()), app); } @@ -539,8 +539,7 @@ void QStyle::polish( QApplication *app ) { \sa polish() */ void QStyle::unPolish( QApplication *app ) { - QStyleControlElementData ceData; - ceData.widgetObjectTypes = getObjectTypeListForObject(app); + QStyleControlElementData ceData = populateControlElementDataFromApplication(app, QStyleOption()); applicationUnPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, QStyleOption()), app); } @@ -2217,6 +2216,12 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen else if (request == WAR_DisableMouseTracking) { widget->setMouseTracking(FALSE); } + else if (request == WAR_SetAutoMask) { + widget->setAutoMask(TRUE); + } + else if (request == WAR_UnSetAutoMask) { + widget->setAutoMask(FALSE); + } else if (request == WAR_SetCheckable) { QPopupMenu *pm = dynamic_cast<QPopupMenu*>(widget); if (pm) { @@ -2253,6 +2258,9 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen else if (request == WAR_SetBackgroundMode) { widget->setBackgroundMode((Qt::BackgroundMode)requestData.metric1); } + else if (request == WAR_SetBackgroundOrigin) { + widget->setBackgroundOrigin((QWidget::BackgroundOrigin)requestData.metric1); + } else if (request == WAR_SetFont) { widget->setFont(requestData.font); } @@ -2289,11 +2297,45 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen return true; } -void QStyle::acceleratorKeypressEventMonitor( QObject *o, QEvent *e ) { - // RAJA FIXME - // Also, SH_HideUnderlineAcceleratorWhenAltUp should probably be set to 1 in the QWindowsStyle::styleHint overridden method - // Additionally, the common styleHint code in TDE (that controls popupmenu settings and such via configuration files) needs to be modified to add a config option for this new style hint +/*! + \fn void QStyle::setApplicationActionRequestHook( ApplicationActionRequestHook hook ); + + 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 ). + + \sa void QStyle::installObjectEventHandler( 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 ); + 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 cbret = false; + if (m_applicationActionRequestHook) { + cbret = (*m_applicationActionRequestHook)(ceData, elementFlags, source, request, requestData); + } + if (!cbret) { + if (ceData.widgetObjectTypes.contains("QApplication")) { + QApplication* application = reinterpret_cast<QApplication*>(source); + if (request == AAR_SetPalette) { + application->setPalette(requestData.palette, requestData.bool1, requestData.cstr); + } + else if (request == AAR_SetFont) { + application->setFont(requestData.font, requestData.bool1, requestData.cstr); + } + return true; + } + } + return true; +} + +void QStyle::acceleratorKeypressEventMonitor( QObject *o, QEvent *e ) { if (styleHint(SH_HideUnderlineAcceleratorWhenAltUp, QStyleControlElementData(), CEF_None, QStyleOption::Default, NULL, NULL) != 0) { QWidget *widget = dynamic_cast<QWidget*>(o); if (widget) { @@ -2337,12 +2379,16 @@ QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(int param1, int par metric2 = param2; } -QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QPalette param) { +QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QPalette param, bool informWidgets, const char* className) { palette = param; + bool1 = informWidgets; + cstr = className; } -QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QFont param) { +QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QFont param, bool informWidgets, const char* className) { font = param; + bool1 = informWidgets; + cstr = className; } QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QRect param) { |