2026-04-06 00:20:51 -05:00

72 lines
2.5 KiB
C++

/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#ifndef KDDOCKWIDGETS_PLATFORM_QTWIDGETS_H
#define KDDOCKWIDGETS_PLATFORM_QTWIDGETS_H
#pragma once
#include "kddockwidgets/qtcommon/Platform.h"
namespace KDDockWidgets {
namespace Core {
class MainWindow;
}
namespace QtWidgets {
/// @brief implements functions specific to a particular platform
/// A platform can be for example qtwidgets, qtquick, etc.
class DOCKS_EXPORT Platform : public QtCommon::Platform_qt
{
public:
Platform();
~Platform() override;
const char *name() const override;
bool hasActivePopup() const override;
std::shared_ptr<Core::View> qobjectAsView(QObject *) const override;
std::shared_ptr<Core::Window> windowFromQWindow(QWindow *) const override;
Core::ViewFactory *createDefaultViewFactory() override;
std::shared_ptr<Core::Window> windowAt(QPoint globalPos) const override;
int screenNumberForView(Core::View *) const override;
QSize screenSizeFor(Core::View *) const override;
int startDragDistance_impl() const override;
Core::View *createView(Core::Controller *controller, Core::View *parent = nullptr) const override;
bool inDisallowedDragView(QPoint globalPos) const override;
bool usesFallbackMouseGrabber() const override;
void ungrabMouse() override;
#ifdef DOCKS_TESTING_METHODS
explicit Platform(int &argc, char **argv, bool defaultToOffscreenQPA);
void tests_initPlatform_impl() override;
void tests_deinitPlatform_impl() override;
Core::View *tests_createView(Core::CreateViewOptions, Core::View *parent = nullptr) override;
Core::View *tests_createFocusableView(Core::CreateViewOptions, Core::View *parent = nullptr) override;
Core::View *tests_createNonClosableView(Core::View *parent = nullptr) override;
std::shared_ptr<Core::Window> tests_createWindow() override;
Core::MainWindow *
createMainWindow(const QString &uniqueName, Core::CreateViewOptions,
MainWindowOptions options = MainWindowOption_HasCentralGroup,
Core::View *parent = nullptr, Qt::WindowFlags = {}) const override;
#endif
protected:
void init();
class GlobalEventFilter;
GlobalEventFilter *const m_globalEventFilter;
};
}
}
#endif