diff options
Diffstat (limited to 'src/uitools/doc/snippets/quiloader')
-rw-r--r-- | src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro | 6 | ||||
-rw-r--r-- | src/uitools/doc/snippets/quiloader/main.cpp | 33 | ||||
-rw-r--r-- | src/uitools/doc/snippets/quiloader/myform.ui | 130 | ||||
-rw-r--r-- | src/uitools/doc/snippets/quiloader/mywidget.cpp | 23 | ||||
-rw-r--r-- | src/uitools/doc/snippets/quiloader/mywidget.h | 15 | ||||
-rw-r--r-- | src/uitools/doc/snippets/quiloader/mywidget.qrc | 5 | ||||
-rw-r--r-- | src/uitools/doc/snippets/quiloader/quiloader.pro | 4 |
7 files changed, 216 insertions, 0 deletions
diff --git a/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro b/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro new file mode 100644 index 000000000..d38258736 --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro @@ -0,0 +1,6 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#! [0] +QT += uitools +#! [0] diff --git a/src/uitools/doc/snippets/quiloader/main.cpp b/src/uitools/doc/snippets/quiloader/main.cpp new file mode 100644 index 000000000..921f5c3f7 --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/main.cpp @@ -0,0 +1,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; + + 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(); +} diff --git a/src/uitools/doc/snippets/quiloader/myform.ui b/src/uitools/doc/snippets/quiloader/myform.ui new file mode 100644 index 000000000..00702e860 --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/myform.ui @@ -0,0 +1,130 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>Form</class> + <widget class="QWidget" name="Form" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>258</width> + <height>224</height> + </rect> + </property> + <property name="windowTitle" > + <string>Export Document</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QGroupBox" name="groupBox" > + <property name="title" > + <string>Export Options</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="1" column="0" > + <widget class="QRadioButton" name="radioButton_2" > + <property name="text" > + <string>&DocBook</string> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QRadioButton" name="radioButton" > + <property name="text" > + <string>&LaTeX</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QCheckBox" name="checkBox_2" > + <property name="text" > + <string>Include p&ictures</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="5" column="0" > + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1" > + <widget class="QCheckBox" name="checkBox" > + <property name="text" > + <string>&Compress</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QRadioButton" name="radioButton_2_2" > + <property name="text" > + <string>&HTML</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QRadioButton" name="radioButton_3" > + <property name="text" > + <string>&PostScript</string> + </property> + </widget> + </item> + <item row="4" column="0" > + <widget class="QRadioButton" name="radioButton_4" > + <property name="text" > + <string>PD&F</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QCheckBox" name="checkBox_3" > + <property name="text" > + <string>Include &metadata</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QCheckBox" name="checkBox_4" > + <property name="text" > + <string>Create inde&x</string> + </property> + <property name="checked" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <resources/> + <connections/> +</ui> diff --git a/src/uitools/doc/snippets/quiloader/mywidget.cpp b/src/uitools/doc/snippets/quiloader/mywidget.cpp new file mode 100644 index 000000000..e9f5d32af --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/mywidget.cpp @@ -0,0 +1,23 @@ +// 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] +MyWidget::MyWidget(QWidget *parent) + : QWidget(parent) +{ + QUiLoader loader; + QFile file(":/forms/myform.ui"); + file.open(QFile::ReadOnly); + QWidget *myWidget = loader.load(&file, this); + file.close(); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(myWidget); + setLayout(layout); +} +//! [0] diff --git a/src/uitools/doc/snippets/quiloader/mywidget.h b/src/uitools/doc/snippets/quiloader/mywidget.h new file mode 100644 index 000000000..9b5addc92 --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/mywidget.h @@ -0,0 +1,15 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef MYWIDGET_H +#define MYWIDGET_H + +#include <QWidget> + +class MyWidget : public QWidget +{ +public: + MyWidget(QWidget *parent = 0); +}; + +#endif diff --git a/src/uitools/doc/snippets/quiloader/mywidget.qrc b/src/uitools/doc/snippets/quiloader/mywidget.qrc new file mode 100644 index 000000000..47684d68b --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/mywidget.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/forms"> +<file>myform.ui</file> +</qresource> +</RCC> diff --git a/src/uitools/doc/snippets/quiloader/quiloader.pro b/src/uitools/doc/snippets/quiloader/quiloader.pro new file mode 100644 index 000000000..31ddf3256 --- /dev/null +++ b/src/uitools/doc/snippets/quiloader/quiloader.pro @@ -0,0 +1,4 @@ +HEADERS = mywidget.h +SOURCES = main.cpp mywidget.cpp +RESOURCES = mywidget.qrc +QT += uitools |