diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-16 07:02:56 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-16 07:02:56 +0100 |
commit | 1d61e0052b6a94546f264c3a37a19db09003d7c8 (patch) | |
tree | 9311e07960d5b08e9948b615f992c36e7bce1cf9 /tests/manual | |
parent | 571a44a4dde8f047773f4e91a4a6941cb4cdf212 (diff) | |
parent | 67041bbc667a10ae14a15ed8755b2b1bbf91b686 (diff) | |
download | qtquickcontrols-1d61e0052b6a94546f264c3a37a19db09003d7c8.tar.gz |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
.qmake.conf
src/dialogs/qquickabstractfiledialog.cpp
src/dialogs/qquickfiledialog.cpp
Change-Id: I60aab7c7e819f82f82fc30f473b36a7a57d9a91a
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/viewinqwidget/main.cpp | 47 | ||||
-rw-r--r-- | tests/manual/viewinqwidget/main.qml | 5 | ||||
-rw-r--r-- | tests/manual/viewinqwidget/viewinqwidget.pro | 7 |
3 files changed, 47 insertions, 12 deletions
diff --git a/tests/manual/viewinqwidget/main.cpp b/tests/manual/viewinqwidget/main.cpp index 0dec4080..dade5e61 100644 --- a/tests/manual/viewinqwidget/main.cpp +++ b/tests/manual/viewinqwidget/main.cpp @@ -27,19 +27,56 @@ ****************************************************************************/ #include <QApplication> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QDebug> +#include <QDesktopWidget> +#include <QGroupBox> +#include <QQmlError> #include <QQuickView> -#include <QWidget> +#include <QQuickWidget> int main(int argc, char *argv[]) { QApplication app(argc, argv); - QQuickView *view = new QQuickView; QWidget widget; - QWidget *container = QWidget::createWindowContainer(view, &widget); - container->setGeometry(100,100,300,300); + widget.setWindowTitle(QT_VERSION_STR); + + const QUrl source(QUrl::fromLocalFile(QLatin1String(SRCDIR) + QStringLiteral("/main.qml"))); + + QHBoxLayout *hLayout = new QHBoxLayout(&widget); + QGroupBox *groupBox = new QGroupBox("QuickWidget", &widget); + QVBoxLayout *vLayout = new QVBoxLayout(groupBox); + QQuickWidget *quickWidget = new QQuickWidget(groupBox); + quickWidget->setMinimumSize(200, 200); + vLayout->addWidget(quickWidget); + quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); + quickWidget->setSource(source); + if (quickWidget->status() == QQuickWidget::Error) { + qWarning() << quickWidget->errors(); + return 1; + } + hLayout->addWidget(groupBox); + + groupBox = new QGroupBox("QQuickView/createWindowContainer", &widget); + vLayout = new QVBoxLayout(groupBox); + QQuickView *view = new QQuickView; + view->setSource(source); + if (view->status() == QQuickView::Error) { + qWarning() << view->errors(); + return 1; + } + + view->setResizeMode(QQuickView::SizeRootObjectToView); + QWidget *container = QWidget::createWindowContainer(view, groupBox); + container->setMinimumSize(200, 200); + vLayout->addWidget(container); + hLayout->addWidget(groupBox); + + const QRect availableGeometry = QApplication::desktop()->availableGeometry(&widget); + widget.move(availableGeometry.center() - QPoint(widget.sizeHint().width() / 2, widget.sizeHint().height() / 2)); - view->setSource(QUrl(QStringLiteral("main.qml"))); widget.show(); return app.exec(); diff --git a/tests/manual/viewinqwidget/main.qml b/tests/manual/viewinqwidget/main.qml index ab3dc948..36c09b50 100644 --- a/tests/manual/viewinqwidget/main.qml +++ b/tests/manual/viewinqwidget/main.qml @@ -31,9 +31,8 @@ import QtQuick.Controls 1.3 Item { visible: true - width: 360 - height: 360 - + width: 200 + height: 200 ComboBox { anchors.centerIn: parent diff --git a/tests/manual/viewinqwidget/viewinqwidget.pro b/tests/manual/viewinqwidget/viewinqwidget.pro index fb0f24f4..bb7cb282 100644 --- a/tests/manual/viewinqwidget/viewinqwidget.pro +++ b/tests/manual/viewinqwidget/viewinqwidget.pro @@ -1,6 +1,5 @@ -QT += qml quick widgets +QT += qml quick widgets quickwidgets TARGET = viewinqwidget SOURCES += $$PWD/main.cpp - -OTHER_FILES += \ - qml/main.qml +DEFINES += SRCDIR=\\\"$$PWD/\\\" +OTHER_FILES += main.qml |