summaryrefslogtreecommitdiff
path: root/src/activeqt/container
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-07-30 13:12:56 +0200
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-07-31 15:07:13 +0200
commit7c56a5b3825de2372712b9f0087df868ca1fd157 (patch)
tree4681aecc3125bbea6a207395b24b59d7bbd91b67 /src/activeqt/container
parent9d511567ece87258ab0bdc77f8c0ab62c075f454 (diff)
downloadqt4-tools-7c56a5b3825de2372712b9f0087df868ca1fd157.tar.gz
QCheckBox on an out-of-process server wont allow <SPACE> key & Focus
rect is not drawn correctly. Depending on the type of server, QAxClientSite::TranslateAccelerator() needs to process the message differently. For ActiveQt based in-process-servers, only normal Qt event handling is required. For ActiveQt based out-of-process-servers, the message has to be forwarded and Qt event handling needs to continue. For all other type of servers, forward the message and stop Qt event processing. Styles use the WA_KeyboardFocusChange attribute set on the window to decide on drawing the focus rect. ActiveQt handles the VK_TAB key in the QAxServerBase::TranslateAcceleratorW(), the attibute is now set when focus is changed. Task-number: 253763 Reviewed-by: Volker Hilsheimer
Diffstat (limited to 'src/activeqt/container')
-rw-r--r--src/activeqt/container/qaxwidget.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index ae468ef52f..19f00db255 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -118,6 +118,8 @@ public:
QSize minimumSizeHint() const;
int qt_metacall(QMetaObject::Call, int isignal, void **argv);
+ void* qt_metacast(const char *clname);
+
inline QAxClientSite *clientSite() const
{
return axhost;
@@ -478,7 +480,9 @@ bool axc_FilterProc(void *m)
QAxWidget *ax = 0;
QAxHostWidget *host = 0;
while (!host && hwnd) {
- host = qobject_cast<QAxHostWidget*>(QWidget::find(hwnd));
+ QWidget *widget = QWidget::find(hwnd);
+ if (widget && widget->inherits("QAxHostWidget"))
+ host = qobject_cast<QAxHostWidget*>(widget);
hwnd = ::GetParent(hwnd);
}
if (host)
@@ -976,10 +980,34 @@ HRESULT WINAPI QAxClientSite::TransformCoords(POINTL* /*pPtlHimetric*/, POINTF*
HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModifiers*/)
{
- eventTranslated = false;
if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam)
return S_OK;
+
+ bool ActiveQtDetected = false;
+ bool fromInProcServer = false;
+ LONG_PTR serverType = GetWindowLongPtr(lpMsg->hwnd, GWLP_USERDATA);
+ if (serverType == QAX_INPROC_SERVER) {
+ ActiveQtDetected = true;
+ fromInProcServer = true;
+ } else if (serverType == QAX_OUTPROC_SERVER) {
+ ActiveQtDetected = true;
+ fromInProcServer = false;
+ }
+
+ eventTranslated = false;
+ if (!ActiveQtDetected || !fromInProcServer) {
+ // if the request is coming from an out-of-proc server or a non ActiveQt server,
+ // we send the message to the host window. This will make sure this key event
+ // comes to Qt for processing.
SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam);
+ if (ActiveQtDetected && !fromInProcServer) {
+ // ActiveQt based servers will need further processing of the event
+ // (eg. <SPACE> key for a checkbox), so we return false.
+ return S_FALSE;
+ }
+ }
+ // ActiveQt based in-processes-servers will handle the event properly, so
+ // we dont need to send this key event to the host.
return S_OK;
}
@@ -1617,6 +1645,14 @@ int QAxHostWidget::qt_metacall(QMetaObject::Call call, int isignal, void **argv)
return -1;
}
+void* QAxHostWidget::qt_metacast(const char *clname)
+{
+ if (!clname) return 0;
+ if (!qstrcmp(clname,"QAxHostWidget"))
+ return static_cast<void*>(const_cast< QAxHostWidget*>(this));
+ return QWidget::qt_metacast(clname);
+}
+
QSize QAxHostWidget::sizeHint() const
{
return axhost ? axhost->sizeHint() : QWidget::sizeHint();