9#include <QtGui/private/qgenericunixeventdispatcher_p.h>
11#include <qpa/qplatformfontdatabase.h>
12#include <QtGui/private/qcoretextfontdatabase_p.h>
14#include <QtGui/private/qgenericunixfontdatabase_p.h>
16#elif defined(Q_OS_WIN)
17#include <QtGui/private/qfreetypefontdatabase_p.h>
18#include <QtCore/private/qeventdispatcher_win_p.h>
21#include <QtCore/qfile.h>
22#include <QtCore/qjsonarray.h>
23#include <QtCore/qjsondocument.h>
24#include <QtCore/qjsonobject.h>
25#include <QtCore/qjsonvalue.h>
26#include <QtGui/private/qpixmap_raster_p.h>
27#include <QtGui/private/qguiapplication_p.h>
28#include <qpa/qplatforminputcontextfactory_p.h>
29#include <qpa/qplatforminputcontext.h>
30#include <qpa/qplatformtheme.h>
31#include <qpa/qwindowsysteminterface.h>
33#include <qpa/qplatformservices.h>
35#if QT_CONFIG(xlib) && QT_CONFIG(opengl) && !QT_CONFIG(opengles2)
45template <
typename BaseEventDispatcher>
50 : BaseEventDispatcher(
parent)
56 bool didSendEvents = BaseEventDispatcher::processEvents(
flags);
70#elif defined(Q_OS_WIN)
74#if QT_CONFIG(draganddrop)
75 m_drag.reset(
new QOffscreenDrag);
128 {
"logicalBaseDpi", 96},
132 {
"synchronousWindowSystemEvents",
false},
133 {
"windowFrameMargins",
true},
141 bool hasConfigFile =
false;
145 QString configPrefix(
"configfile="_L1);
146 if (
param.startsWith(configPrefix)) {
147 hasConfigFile =
true;
156 qFatal(
"Missing file path for -configfile platform option");
157 QFile configFile(configFilePath);
159 qFatal(
"Could not find platform config file %s",
qPrintable(configFilePath));
177 const bool synchronousWindowSystemEvents =
configuration[
"synchronousWindowSystemEvents"].toBool(
197 auto currentNames = getScreenNames(currentScreens);
198 auto newNames = getScreenNames(newScreens);
201 std::set_intersection(currentNames.begin(), currentNames.end(), newNames.begin(), newNames.end(),
202 std::inserter(present, present.
begin()));
204 std::set_difference(newNames.begin(), newNames.end(), currentNames.begin(), currentNames.end(),
205 std::inserter(added, added.
begin()));
207 std::set_difference(currentNames.begin(), currentNames.end(), newNames.begin(), newNames.end(),
208 std::inserter(removed, removed.
begin()));
219 for (
QJsonValue screenConfig : screenConfigs) {
239 QJsonValue configValue = screenConfigByName(
add, newScreens);
250 offscreenScreen->
m_dpr =
config[
"dpr"].toDouble(1.0);
256 for (
const QString &pres : present) {
259 QJsonObject currentConfig = screenConfigByName(pres, currentScreens).toObject();
260 QJsonObject newConfig = screenConfigByName(pres, newScreens).toObject();
263 Q_ASSERT(currentConfig[
"name"] == newConfig[
"name"]);
266 QRect currentGeomtry = geometryFromConfig(currentConfig);
267 QRect newGeomtry = geometryFromConfig(newConfig);
268 if (currentGeomtry != newGeomtry) {
269 screen->m_geometry = newGeomtry;
274 int currentLogicalDpi = currentConfig[
"logicalDpi"].toInt(96);
275 int newLogicalDpi = newConfig[
"logicalDpi"].toInt(96);
276 if (currentLogicalDpi != newLogicalDpi) {
277 screen->m_logicalDpi = newLogicalDpi;
283 int currentLogicalBaseDpi = currentConfig[
"logicalBaseDpi"].toInt(96);
284 int newLogicalBaseDpi = newConfig[
"logicalBaseDpi"].toInt(96);
285 if (currentLogicalBaseDpi != newLogicalBaseDpi) {
286 screen->m_logicalBaseDpi = newLogicalBaseDpi;
287 qWarning(
"You ain't supposed to change logicalBaseDpi - its a platform constant. Qt may not react to the change");
293 double currentDpr = currentConfig[
"dpr"].toDouble(1);
294 double newDpr = newConfig[
"dpr"].toDouble(1);
295 if (currentDpr != newDpr) {
297 qWarning(
"DPR change notifications is not implemented - Qt may not react to the change");
334 w->requestActivateWindow();
345#if defined(Q_OS_UNIX)
346 return createUnixEventDispatcher();
347#elif defined(Q_OS_WIN)
388 static QFont systemFont(
"Sans Serif"_L1, 9);
389 static QFont fixedFont(
"monospace"_L1, 9);
411#if QT_CONFIG(draganddrop)
414 return m_drag.data();
427#if QT_CONFIG(xlib) && QT_CONFIG(opengl) && !QT_CONFIG(opengles2)
433 if (!offscreenIntegration)
435 return offscreenIntegration;
QVariant themeHint(ThemeHint h) const override
virtual const QFont * font(Font type=SystemFont) const override
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QJsonObject toObject() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
qsizetype removeAll(const AT &t)
void append(parameter_type t)
QOffscreenEventDispatcher(QObject *parent=nullptr)
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
QList< QOffscreenScreen * > m_screens
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QScopedPointer< QPlatformNativeInterface > m_nativeInterface
QScopedPointer< QPlatformInputContext > m_inputContext
std::optional< QJsonObject > resolveConfigFileConfiguration(const QStringList ¶mList) const
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QList< QOffscreenScreen * > screens() const
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QJsonObject configuration() const
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QPlatformTheme * createPlatformTheme(const QString &name) const override
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QOffscreenIntegration(const QStringList ¶mList)
QScopedPointer< QPlatformFontDatabase > m_fontDatabase
QPlatformServices * services() const override
QPlatformNativeInterface * nativeInterface() const override
static QOffscreenIntegration * createOffscreenIntegration(const QStringList ¶mList)
bool hasCapability(QPlatformIntegration::Capability cap) const override
QJsonObject m_configuration
QJsonObject defaultConfiguration() const
QStringList themeNames() const override
bool m_windowFrameMarginsEnabled
void setConfiguration(const QJsonObject &configuration)
QScopedPointer< QPlatformServices > m_services
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
static QPlatformInputContext * create()
The QPlatformInputContext class abstracts the input method dependent data and composing state.
\inmodule QtCore\reentrant
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry, const QRect &newAvailableGeometry)
static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
static void setSynchronousWindowSystemEvents(bool enable)
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.
static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY)
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
QPlatformFontDatabase QGenericUnixFontDatabase
static QString themeName()
GLfloat GLfloat GLfloat w
[0]
GLenum const GLint * param
GLfloat GLfloat GLfloat GLfloat h
static void add(QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
#define qPrintable(string)
#define QStringLiteral(str)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static int toInt(const QChar &qc, int R)
settings remove("monkey")
char * toString(const MyType &t)
[31]
\inmodule QtCore\reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
QT_BEGIN_NAMESPACE bool toBool(const QString &str)