diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-16 10:34:55 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-16 10:34:55 -0500 |
commit | 4f8eb0410d666d41ccbc39b2bf5dea336af5c26c (patch) | |
tree | f5b12b414c46a9ecfa90b389304c7b29526f41fd | |
parent | 1faf4cf70f8ed79f83bb4e8c1ccbb2c52b1aec44 (diff) | |
download | qt3-4f8eb0410d666d41ccbc39b2bf5dea336af5c26c.tar.gz qt3-4f8eb0410d666d41ccbc39b2bf5dea336af5c26c.zip |
Add WAR_SetDefault and friends
-rw-r--r-- | src/kernel/qapplication_x11.cpp | 4 | ||||
-rw-r--r-- | src/kernel/qstyle.cpp | 35 | ||||
-rw-r--r-- | src/kernel/qstyle.h | 11 |
3 files changed, 44 insertions, 6 deletions
diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index 6a68604..2873b9e 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -5184,8 +5184,6 @@ bool QETWidget::translateKeyEventInternal( const XEvent *event, int& count, qAddPostRoutine( deleteKeyDicts ); } - QWidget* tlw = topLevelWidget(); - XKeyEvent xkeyevent = event->xkey; // save the modifier state, we will use the keystate uint later by passing @@ -5211,7 +5209,6 @@ bool QETWidget::translateKeyEventInternal( const XEvent *event, int& count, // Implementation for X11R5 and newer, using XIM int keycode = event->xkey.keycode; - Status status; if ( type == QEvent::KeyPress ) { bool mb=FALSE; @@ -5295,7 +5292,6 @@ bool QETWidget::translateKeyEventInternal( const XEvent *event, int& count, // and independent of whether char is signed or not. textDict->replace( keycode, (void*)(long)(256+ascii) ); } - tlw = 0; } else { key = (int)(long)keyDict->find( keycode ); if ( key ) 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 diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h index 2d76d09..1690786 100644 --- a/src/kernel/qstyle.h +++ b/src/kernel/qstyle.h @@ -251,6 +251,10 @@ class QStyleControlElementData { Q_UINT32 comboBoxLineEditFlags; Q_UINT32 frameStyle; QRect sliderRect; + QPainter* activePainter; + + public: + QStyleControlElementData(); }; class Q_EXPORT QStyleWidgetActionRequestData { @@ -260,6 +264,7 @@ class Q_EXPORT QStyleWidgetActionRequestData { QStyleWidgetActionRequestData(QPalette palette, bool informWidgets = FALSE, const char* className = 0); QStyleWidgetActionRequestData(QFont font, bool informWidgets = FALSE, const char* className = 0); QStyleWidgetActionRequestData(QRect rect); + QStyleWidgetActionRequestData(QPaintEvent* paintEvent); ~QStyleWidgetActionRequestData(); public: bool bool1; @@ -271,6 +276,7 @@ class Q_EXPORT QStyleWidgetActionRequestData { QRect rect; const char * cstr; QString string; + QPaintEvent * paintEvent; }; typedef QStyleWidgetActionRequestData QStyleApplicationActionRequestData; @@ -1094,7 +1100,10 @@ public: WAR_SetBackgroundMode, WAR_SetBackgroundOrigin, WAR_SetFont, - WAR_RepaintAllAccelerators + WAR_RepaintAllAccelerators, + WAR_SetDefault, + WAR_UnSetDefault, + WAR_SendPaintEvent }; typedef bool (*WidgetActionRequestHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData); |