blob: 91deb2fc1965aaf1ca34a68cbb3a53e320feea54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
#include <QtUiTools>
#include "mywidget.h"
//! [0]
QWidget *loadCustomWidget(QWidget *parent)
{
QUiLoader loader;
QWidget *myWidget = nullptr;
QStringList availableWidgets = loader.availableWidgets();
if (availableWidgets.contains("AnalogClock"))
myWidget = loader.createWidget("AnalogClock", parent);
return myWidget;
}
//! [0]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyWidget widget;
widget.show();
QWidget *customWidget = loadCustomWidget(0);
customWidget->show();
return app.exec();
}
|