Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qhaikuintegration.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qhaikuintegration.h"
5
6#include "qhaikuapplication.h"
7#include "qhaikuclipboard.h"
10#include "qhaikuscreen.h"
11#include "qhaikuservices.h"
12
13#include <QCoreApplication>
14#include <QFileInfo>
15#include <qpa/qplatformwindow.h>
16#include <qpa/qwindowsysteminterface.h>
17#include <QtGui/private/qgenericunixeventdispatcher_p.h>
18
19#include <Application.h>
20
22
23static long int startApplicationThread(void *data)
24{
26 app->LockLooper();
27 return app->Run();
28}
29
31 : m_clipboard(new QHaikuClipboard)
32{
33 Q_UNUSED(parameters);
34
35 const QString signature = QStringLiteral("application/x-vnd.Qt.%1").arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
36
37 QHaikuApplication *app = new QHaikuApplication(signature.toLocal8Bit());
38 be_app = app;
39
40 const thread_id applicationThreadId = spawn_thread(startApplicationThread, "app_thread", 1, static_cast<void*>(app));
41 resume_thread(applicationThreadId);
42 app->UnlockLooper();
43
44 m_screen = new QHaikuScreen;
45
46 m_services = new QHaikuServices;
47
48 // notify system about available screen
50}
51
53{
55 m_screen = nullptr;
56
57 delete m_services;
58 m_services = nullptr;
59
60 delete m_clipboard;
61 m_clipboard = nullptr;
62
63 be_app->LockLooper();
64 be_app->Quit();
65}
66
68{
69 return QPlatformIntegration::hasCapability(capability);
70}
71
73{
75}
76
78{
79 return m_services;
80}
81
83{
84 return m_clipboard;
85}
86
88{
89 QPlatformWindow *platformWindow = new QHaikuRasterWindow(window);
90 platformWindow->requestActivateWindow();
91 return platformWindow;
92}
93
95{
97}
98
100{
101 return createUnixEventDispatcher();
102}
103
static QString applicationFilePath()
Returns the file path of the application executable.
\inmodule QtCore \reentrant
Definition qfileinfo.h:22
bool hasCapability(QPlatformIntegration::Capability cap) const override
QHaikuIntegration(const QStringList &paramList)
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformServices * services() const override
The QPlatformBackingStore class provides the drawing area for top-level windows.
The QPlatformClipboard class provides an abstraction for the system clipboard.
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
virtual bool hasCapability(Capability cap) const
virtual QPlatformFontDatabase * fontDatabase() const
Accessor for the platform integration's fontdatabase.
Capability
Capabilities are used to determine specific features of a platform integration.
The QPlatformServices provides the backend for desktop-related functionality.
The QPlatformWindow class provides an abstraction for top-level windows.
virtual void requestActivateWindow()
Reimplement to let Qt be able to request activation/focus for a window.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary=false)
Should be called by the implementation whenever a new screen is added.
static void handleScreenRemoved(QPlatformScreen *screen)
Should be called by the implementation whenever a screen is removed.
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE long int startApplicationThread(void *data)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QStringLiteral(str)
#define Q_UNUSED(x)
QApplication app(argc, argv)
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]