13#include "kddockwidgets/KDDockWidgets.h"
17#include "views/ViewWrapper_p.h"
18#include "views/View.h"
19#include "core/Platform_p.h"
23#include <QApplication>
25#include <QAbstractButton>
26#include <QStyleFactory>
30#if defined(KDDOCKWIDGETS_STATICLIB) || defined(QT_STATIC)
31static void initResources()
33 Q_INIT_RESOURCE(kddockwidgets_resources);
42class Platform::GlobalEventFilter :
public QObject
61 if (
auto w = qobject_cast<QWidget *>(o)) {
65 QtWidgets::ViewWrapper::create(w));
70 QtWidgets::ViewWrapper::create(w));
78 ~GlobalEventFilter()
override;
81Platform::GlobalEventFilter::~GlobalEventFilter() =
default;
84 : m_globalEventFilter(new GlobalEventFilter())
91#if defined(KDDOCKWIDGETS_STATICLIB) || defined(QT_STATIC)
95#ifdef DOCKS_DEVELOPER_MODE
96 if (qEnvironmentVariableIntValue(
"KDDOCKWIDGETS_SHOW_DEBUG_WINDOW") == 1) {
103 d->focusedViewChanged.emit(QtWidgets::ViewWrapper::create(obj));
119 return qApp->activePopupWidget() !=
nullptr;
124 return QtWidgets::ViewWrapper::create(obj);
130 return std::shared_ptr<Core::Window>(
new Window(qwindow));
140 if (
auto qwindow = qGuiApp->QGuiApplication::topLevelAt(globalPos)) {
141 auto window =
new Window(qwindow);
142 return Core::Window::Ptr(window);
150 if (
auto widget = QtCommon::View_qt::asQWidget(view)) {
151 if (
QWindow *qtwindow = widget->window()->windowHandle())
160 if (
auto widget = QtCommon::View_qt::asQWidget(view)) {
161 if (
QScreen *screen = widget->screen()) {
162 return screen->size();
177 QtCommon::View_qt::asQWidget(parent));
188 QWidget *widget = qApp->widgetAt(globalPos);
194 return qobject_cast<QAbstractButton *>(widget) || qobject_cast<QLineEdit *>(widget);
200 grabber->releaseMouse();
203#ifdef DOCKS_TESTING_METHODS
207 QtCommon::Platform_qt::maybeSetOffscreenQPA(argc, argv);
212 : Platform_qt(createCoreApplication(argc, argv))
213 , m_globalEventFilter(new
Platform::GlobalEventFilter())
215 qputenv(
"KDDOCKWIDGETS_SHOW_DEBUG_WINDOW",
"");
Window to show debug information. Used for debugging only, for apps that don't support GammaRay.
QEvent::Type type() const const
void focusObjectChanged(QObject *focusObject)
virtual bool eventFilter(QObject *watched, QEvent *event)
void installEventFilter(QObject *filterObj)
QStyle * create(const QString &key)