summaryrefslogtreecommitdiffstats
path: root/tests/manual/mediaplayer/mediaaxwidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/mediaplayer/mediaaxwidget.h')
-rw-r--r--tests/manual/mediaplayer/mediaaxwidget.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/manual/mediaplayer/mediaaxwidget.h b/tests/manual/mediaplayer/mediaaxwidget.h
new file mode 100644
index 0000000..3a49b61
--- /dev/null
+++ b/tests/manual/mediaplayer/mediaaxwidget.h
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef MEDIAAXWIDGET_H
+#define MEDIAAXWIDGET_H
+
+#include <QtAxContainer/QAxWidget>
+#include <qt_windows.h>
+
+// Overrides the translateKeyEvent() function to pass keystrokes
+// to the Windows Media Player ActiveX control.
+class MediaAxWidget : public QAxWidget
+{
+public:
+ MediaAxWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {})
+ : QAxWidget(parent, f)
+ {
+ }
+
+protected:
+ bool translateKeyEvent(int message, int keycode) const override
+ {
+ if (message >= WM_KEYFIRST && message <= WM_KEYLAST)
+ return true;
+ return QAxWidget::translateKeyEvent(message, keycode);
+ }
+};
+
+#endif // MEDIAAXWIDGET_H