Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtWidgets>
5#include <QtGui>
6
7//! [0]
9{
10 Q_OBJECT
11 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "mystyleplugin.json")
12public:
14
15 QStyle *create(const QString &key) override;
17};
18//! [0]
19
21{
22public:
24
25};
26
28{
29public:
31};
32
33MyStylePlugin::MyStylePlugin(QObject *parent)
34 : QStylePlugin(parent)
35{
36}
37
39{
40 return QStringList() << "Rocket" << "StarBuster";
41}
42
43//! [1]
44QStyle *MyStylePlugin::create(const QString &key)
45{
46 QString lcKey = key.toLower();
47 if (lcKey == "rocket") {
48 return new RocketStyle;
49 } else if (lcKey == "starbuster") {
50 return new StarBusterStyle;
51 }
52 return nullptr;
53}
54//! [1]
55
56int main(int argc, char *argv[])
57{
58 QApplication app(argc, argv);
59 MyStylePlugin plugin;
60 return app.exec();
61}
QStyle * create(const QString &key) override
[1]
Definition main.cpp:44
QStringList keys() const
Definition main.cpp:38
RocketStyle()
Definition main.cpp:23
int main(int argc, char *argv[])
[ctor_close]