1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
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 <qpa/qplatformintegrationplugin.h> |
5 | #include "qxcbintegration.h" |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | using namespace Qt::StringLiterals; |
10 | |
11 | class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin |
12 | { |
13 | Q_OBJECT |
14 | Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "xcb.json") |
15 | public: |
16 | QPlatformIntegration *create(const QString&, const QStringList&, int &, char **) override; |
17 | }; |
18 | |
19 | QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) |
20 | { |
21 | if (!system.compare(other: "xcb"_L1, cs: Qt::CaseInsensitive)) { |
22 | auto xcbIntegration = new QXcbIntegration(parameters, argc, argv); |
23 | if (!xcbIntegration->hasConnection()) { |
24 | delete xcbIntegration; |
25 | return nullptr; |
26 | } |
27 | return xcbIntegration; |
28 | } |
29 | |
30 | return nullptr; |
31 | } |
32 | |
33 | QT_END_NAMESPACE |
34 | |
35 | #include "qxcbmain.moc" |
36 |