Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
23using namespace Qt::Literals::StringLiterals;
24
25static long int startApplicationThread(void *data)
26{
28 app->LockLooper();
29 return app->Run();
30}
31
33 : m_clipboard(new QHaikuClipboard)
34{
35 Q_UNUSED(parameters);
36
37 const QString signature = "application/x-vnd.Qt.%1"_L1.arg(QFileInfo(QCoreApplication::applicationFilePath()).fileName());
38
39 QHaikuApplication *app = new QHaikuApplication(signature.toLocal8Bit());
40 be_app = app;
41
42 const thread_id applicationThreadId = spawn_thread(startApplicationThread, "app_thread", 1, static_cast<void*>(app));
43 resume_thread(applicationThreadId);
44 app->UnlockLooper();
45
46 m_screen = new QHaikuScreen;
47
48 m_services = new QHaikuServices;
49
50 // notify system about available screen
52}
53
55{
57 m_screen = nullptr;
58
59 delete m_services;
60 m_services = nullptr;
61
62 delete m_clipboard;
63 m_clipboard = nullptr;
64
65 be_app->LockLooper();
66 be_app->Quit();
67}
68
73
78
80{
81 return m_services;
82}
83
85{
86 return m_clipboard;
87}
88
90{
91 QPlatformWindow *platformWindow = new QHaikuRasterWindow(window);
92 platformWindow->requestActivateWindow();
93 return platformWindow;
94}
95
100
102{
103 return createUnixEventDispatcher();
104}
105
static QString applicationFilePath()
Returns the file path of the application executable.
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:129
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 long int startApplicationThread(void *data)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_UNUSED(x)
QApplication app(argc, argv)
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]