KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
qtcommon/Platform.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#pragma once
13
14#include "kddockwidgets/docks_export.h"
15#include "kddockwidgets/core/Platform.h"
16
17QT_BEGIN_NAMESPACE
19QT_END_NAMESPACE
20
21namespace KDDockWidgets {
22
23namespace Core {
24class Window;
25class View;
26}
27
28namespace QtCommon {
29
32class DOCKS_EXPORT Platform_qt : public Core::Platform
33{
34public:
36 ~Platform_qt() override;
37
38 std::shared_ptr<Core::View> focusedView() const override;
39 QVector<std::shared_ptr<Core::Window>> windows() const override;
40 virtual std::shared_ptr<Core::Window> windowFromQWindow(QWindow *) const = 0;
41 int screenNumberForWindow(std::shared_ptr<Core::Window>) const override;
42
43 void sendEvent(Core::View *, QEvent *) const override;
44
45 bool isProcessingAppQuitEvent() const override;
46
47 QString applicationName() const override;
48
49 void setMouseCursor(Qt::CursorShape, bool discardLast = false) override;
50 void restoreMouseCursor() override;
51
52 DisplayType displayType() const override;
53 bool isLeftMouseButtonPressed() const override;
54
55 QVector<std::shared_ptr<Core::Screen>> screens() const override;
56
57 QPoint cursorPos() const override;
58 void setCursorPos(QPoint) override;
59
62 virtual std::shared_ptr<Core::View> qobjectAsView(QObject *) const = 0;
63 std::shared_ptr<Core::Window> qobjectAsWindow(QObject *) const;
64
65 static Platform_qt *instance();
66
67 std::shared_ptr<Core::Screen> primaryScreen() const override;
68
69 void runDelayed(int ms, Core::DelayedCall *) override;
70
71 QByteArray readFile(const QString &fileName, bool &ok) const override;
72
73 bool supportsAeroSnap() const override;
74
75#ifdef DOCKS_DEVELOPER_MODE
76
78
79 static bool isGammaray();
80 explicit Platform_qt(QCoreApplication *);
81 bool tests_waitForWindowActive(std::shared_ptr<Core::Window>, int timeout = 5000) const override;
82 bool tests_waitForEvent(Core::Object *w, QEvent::Type type, int timeout = 5000) const override;
83 bool tests_waitForEvent(Core::View *, QEvent::Type type, int timeout = 5000) const override;
84 bool tests_waitForEvent(std::shared_ptr<Core::Window>, QEvent::Type type,
85 int timeout = 5000) const override;
86 void tests_initPlatform_impl() override;
87 void tests_deinitPlatform_impl() override;
88 bool tests_wait(int ms) const override;
89 void tests_pressOn(QPoint globalPos, Core::View *receiver) override;
90 void tests_pressOn(QPoint globalPos, std::shared_ptr<Core::Window> receiver) override;
91 bool tests_releaseOn(QPoint globalPos, Core::View *receiver) override;
92 void tests_doubleClickOn(QPoint globalPos, Core::View *receiver) override;
93 void tests_doubleClickOn(QPoint globalPos, std::shared_ptr<Core::Window> receiver) override;
94 bool tests_mouseMove(QPoint globalPos, Core::View *receiver) override;
95
96 void installMessageHandler() override;
97 void uninstallMessageHandler() override;
98
100 static void maybeSetOffscreenQPA(int argc, char **argv);
101
102 bool tests_waitForResize(Core::View *, int timeout = 2000) const override;
103 bool tests_waitForResize(Core::Controller *, int timeout = 2000) const override;
104 bool tests_waitForDeleted(Core::View *, int timeout = 2000) const override;
105 bool tests_waitForDeleted(Core::Controller *, int timeout = 2000) const override;
106
107#endif
108
109protected:
110 int screenNumberForQWindow(QWindow *) const;
111
112private:
113 class GlobalEventFilter;
114 GlobalEventFilter *const m_globalEventFilter;
115 Q_DISABLE_COPY(Platform_qt)
116};
117
118}
119
120}
implements functions specific to a particular platform A platform can be for example qtwidgets,...
DisplayType
Enum describing the graphics stack type.
Baseclass platform for Qt based platform Useful since QtWidgets and QtQuick share some similarities.
virtual std::shared_ptr< Core::View > qobjectAsView(QObject *) const =0
Returns the specified QObject casted to View Nullptr if it's not a view.
virtual std::shared_ptr< Core::Window > windowFromQWindow(QWindow *) const =0
Class to abstract QAction, so code still works with QtQuick and Flutter.
CursorShape

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8