summaryrefslogtreecommitdiffstats
path: root/src/kernel/qstyle.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-10-16 10:34:55 -0500
committerTimothy Pearson <[email protected]>2012-10-16 10:34:55 -0500
commit4f8eb0410d666d41ccbc39b2bf5dea336af5c26c (patch)
treef5b12b414c46a9ecfa90b389304c7b29526f41fd /src/kernel/qstyle.cpp
parent1faf4cf70f8ed79f83bb4e8c1ccbb2c52b1aec44 (diff)
downloadqt3-4f8eb0410d666d41ccbc39b2bf5dea336af5c26c.tar.gz
qt3-4f8eb0410d666d41ccbc39b2bf5dea336af5c26c.zip
Add WAR_SetDefault and friends
Diffstat (limited to 'src/kernel/qstyle.cpp')
-rw-r--r--src/kernel/qstyle.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index e7d3fa5..843027d 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -48,6 +48,7 @@
#include "qlayout.h"
#include "qlistview.h"
#include "qpopupmenu.h"
+#include "qpushbutton.h"
#include "qobjectlist.h"
#include "qwidgetlist.h"
@@ -2165,7 +2166,16 @@ bool QStyle::eventFilter(QObject *o, QEvent *e) {
QStyle* handler = m_objectEventSourceToHandlerMap[o];
QStyleControlElementData ceData = m_objectEventSourceDataToHandlerMap[o];
ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o];
- bool ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ bool ret;
+ QWidget* w = dynamic_cast<QWidget*>(o);
+ if ((w) && (e->type() == QEvent::Paint)) {
+ QPainter p(w);
+ ceData.activePainter = &p;
+ ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ }
+ else {
+ ret = handler->objectEventHandler(ceData, elementFlags, o, e);
+ }
if (ret) {
return ret;
}
@@ -2291,6 +2301,21 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen
}
delete list;
}
+ else if (request == WAR_SetDefault) {
+ QPushButton *button = dynamic_cast<QPushButton*>(widget);
+ if (button) {
+ button->setDefault(TRUE);
+ }
+ }
+ else if (request == WAR_UnSetDefault) {
+ QPushButton *button = dynamic_cast<QPushButton*>(widget);
+ if (button) {
+ button->setDefault(FALSE);
+ }
+ }
+ else if (request == WAR_SendPaintEvent) {
+ static_cast<QObject*>(widget)->event(requestData.paintEvent);
+ }
return true;
}
}
@@ -2395,6 +2420,10 @@ QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QRect param) {
rect = param;
}
+QStyleWidgetActionRequestData::QStyleWidgetActionRequestData(QPaintEvent* param) {
+ paintEvent = param;
+}
+
QStyleWidgetActionRequestData::~QStyleWidgetActionRequestData() {
//
}
@@ -2575,4 +2604,8 @@ QPixmap QStyle::stylePixmap(StylePixmap sp, const QWidget *w, const QStyleOption
\obsolete
*/
+QStyleControlElementData::QStyleControlElementData() {
+ activePainter = 0;
+}
+
#endif // QT_NO_STYLE