Manual iconbrowser test: Add a Quick test tab
Task-number: QTBUG-102346 Change-Id: I80dc7a393f08510c26ac8802e24b17e760c21e56 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
ea6abe583f
commit
4bce81b03b
@ -14,6 +14,20 @@ qt_internal_add_manual_test(iconbrowser
|
|||||||
Qt::WidgetsPrivate
|
Qt::WidgetsPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (TARGET Qt::Quick)
|
||||||
|
find_package(Qt6 COMPONENTS QuickWidgets REQUIRED)
|
||||||
|
|
||||||
|
qt_add_qml_module(iconbrowser
|
||||||
|
URI main
|
||||||
|
VERSION 1.0
|
||||||
|
QML_FILES "Main.qml"
|
||||||
|
NO_RESOURCE_TARGET_PATH
|
||||||
|
)
|
||||||
|
target_link_libraries(iconbrowser PRIVATE
|
||||||
|
Qt6::QuickWidgets
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
set(font_filename "MaterialIcons-Regular.ttf")
|
set(font_filename "MaterialIcons-Regular.ttf")
|
||||||
if (QT_ALLOW_DOWNLOAD)
|
if (QT_ALLOW_DOWNLOAD)
|
||||||
|
31
tests/manual/iconbrowser/Main.qml
Normal file
31
tests/manual/iconbrowser/Main.qml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
Column {
|
||||||
|
Row {
|
||||||
|
ToolButton {
|
||||||
|
id: normalButton
|
||||||
|
icon.name: iconName.text
|
||||||
|
}
|
||||||
|
ToolButton {
|
||||||
|
id: disabledButton
|
||||||
|
enabled: false
|
||||||
|
icon.name: iconName.text
|
||||||
|
}
|
||||||
|
ToolButton {
|
||||||
|
id: checkedButton
|
||||||
|
checked: true
|
||||||
|
icon.name: iconName.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TextField {
|
||||||
|
id: iconName
|
||||||
|
text: "folder"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,10 @@
|
|||||||
#include <QtWidgets/private/qapplication_p.h>
|
#include <QtWidgets/private/qapplication_p.h>
|
||||||
#include <QtGui/qpa/qplatformtheme.h>
|
#include <QtGui/qpa/qplatformtheme.h>
|
||||||
|
|
||||||
|
#ifdef QT_QUICKWIDGETS_LIB
|
||||||
|
#include <QQuickWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
class IconModel : public QAbstractItemModel
|
class IconModel : public QAbstractItemModel
|
||||||
@ -547,6 +551,21 @@ int main(int argc, char* argv[])
|
|||||||
widget.addTab(new IconView<IconModel::Style>(&model), "QStyle");
|
widget.addTab(new IconView<IconModel::Style>(&model), "QStyle");
|
||||||
widget.addTab(new IconView<IconModel::Theme>(&model), "QPlatformTheme");
|
widget.addTab(new IconView<IconModel::Theme>(&model), "QPlatformTheme");
|
||||||
|
|
||||||
|
#ifdef QT_QUICKWIDGETS_LIB
|
||||||
|
QQuickWidget *quickBrowser = new QQuickWidget;
|
||||||
|
quickBrowser->setSource(QUrl(u"qrc:/Main.qml"_s));
|
||||||
|
quickBrowser->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
|
widget.addTab(quickBrowser, "Qt Quick");
|
||||||
|
QObject::connect(quickBrowser, &QQuickWidget::statusChanged, quickBrowser,
|
||||||
|
[](QQuickWidget::Status status){
|
||||||
|
qDebug() << status;
|
||||||
|
});
|
||||||
|
QObject::connect(quickBrowser, &QQuickWidget::sceneGraphError, quickBrowser,
|
||||||
|
[](QQuickWindow::SceneGraphError error, const QString &message){
|
||||||
|
qDebug() << error << message;
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
widget.show();
|
widget.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user