mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-18 20:39:36 +00:00
added Example
This commit is contained in:
parent
8b74e6987c
commit
1f163b5b0b
14
examples/TestQMLWidgets/HomeForm.ui.qml
Normal file
14
examples/TestQMLWidgets/HomeForm.ui.qml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
Page {
|
||||||
|
width: 600
|
||||||
|
height: 400
|
||||||
|
|
||||||
|
title: qsTr("Home")
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("You are on the home page.")
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
14
examples/TestQMLWidgets/Page1Form.ui.qml
Normal file
14
examples/TestQMLWidgets/Page1Form.ui.qml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
Page {
|
||||||
|
width: 600
|
||||||
|
height: 400
|
||||||
|
|
||||||
|
title: qsTr("Page 1")
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("You are on Page 1.")
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
14
examples/TestQMLWidgets/Page2Form.ui.qml
Normal file
14
examples/TestQMLWidgets/Page2Form.ui.qml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
Page {
|
||||||
|
width: 600
|
||||||
|
height: 400
|
||||||
|
|
||||||
|
title: qsTr("Page 2")
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("You are on Page 2.")
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
27
examples/TestQMLWidgets/TestQMLWidgets.pro
Normal file
27
examples/TestQMLWidgets/TestQMLWidgets.pro
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
QT += quick
|
||||||
|
CONFIG += c++11
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Refer to the documentation for the
|
||||||
|
# deprecated API to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
RESOURCES += qml.qrc
|
||||||
|
|
||||||
|
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||||
|
QML_IMPORT_PATH =
|
||||||
|
|
||||||
|
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||||
|
QML_DESIGNER_IMPORT_PATH =
|
||||||
|
|
||||||
|
DESTDIR="$$PWD/../build"
|
||||||
|
|
16
examples/TestQMLWidgets/main.cpp
Normal file
16
examples/TestQMLWidgets/main.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
|
if (engine.rootObjects().isEmpty())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
65
examples/TestQMLWidgets/main.qml
Normal file
65
examples/TestQMLWidgets/main.qml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
id: window
|
||||||
|
visible: true
|
||||||
|
width: 640
|
||||||
|
height: 480
|
||||||
|
title: qsTr("Stack")
|
||||||
|
|
||||||
|
header: ToolBar {
|
||||||
|
contentHeight: toolButton.implicitHeight
|
||||||
|
|
||||||
|
ToolButton {
|
||||||
|
id: toolButton
|
||||||
|
text: stackView.depth > 1 ? "\u25C0" : "\u2630"
|
||||||
|
font.pixelSize: Qt.application.font.pixelSize * 1.6
|
||||||
|
onClicked: {
|
||||||
|
if (stackView.depth > 1) {
|
||||||
|
stackView.pop()
|
||||||
|
} else {
|
||||||
|
drawer.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: stackView.currentItem.title
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Drawer {
|
||||||
|
id: drawer
|
||||||
|
width: window.width * 0.66
|
||||||
|
height: window.height
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
ItemDelegate {
|
||||||
|
text: qsTr("Page 1")
|
||||||
|
width: parent.width
|
||||||
|
onClicked: {
|
||||||
|
stackView.push("Page1Form.ui.qml")
|
||||||
|
drawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ItemDelegate {
|
||||||
|
text: qsTr("Page 2")
|
||||||
|
width: parent.width
|
||||||
|
onClicked: {
|
||||||
|
stackView.push("Page2Form.ui.qml")
|
||||||
|
drawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StackView {
|
||||||
|
id: stackView
|
||||||
|
initialItem: "HomeForm.ui.qml"
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
9
examples/TestQMLWidgets/qml.qrc
Normal file
9
examples/TestQMLWidgets/qml.qrc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>main.qml</file>
|
||||||
|
<file>HomeForm.ui.qml</file>
|
||||||
|
<file>Page1Form.ui.qml</file>
|
||||||
|
<file>Page2Form.ui.qml</file>
|
||||||
|
<file>qtquickcontrols2.conf</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
6
examples/TestQMLWidgets/qtquickcontrols2.conf
Normal file
6
examples/TestQMLWidgets/qtquickcontrols2.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
; This file can be edited to change the style of the application
|
||||||
|
; Read "Qt Quick Controls 2 Configuration File" for details:
|
||||||
|
; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html
|
||||||
|
|
||||||
|
[Controls]
|
||||||
|
Style=Imagine
|
2
examples/TestQMLWidgets/readmy.md
Normal file
2
examples/TestQMLWidgets/readmy.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# this example for packing apps to snap
|
||||||
|
|
14
examples/TestQMLWidgets/snap/snapcraft.yaml
Normal file
14
examples/TestQMLWidgets/snap/snapcraft.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
name: cqtdeployerexample # you probably want to 'snapcraft register <name>'
|
||||||
|
base: core18 # the base snap is the execution environment for this snap
|
||||||
|
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
|
||||||
|
summary: simple example for packing with cqtdeployer # 79 char long summary
|
||||||
|
description: |
|
||||||
|
simple example for packing with cqtdeployer
|
||||||
|
|
||||||
|
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||||
|
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||||
|
|
||||||
|
parts:
|
||||||
|
my-part:
|
||||||
|
# See 'snapcraft plugins'
|
||||||
|
plugin: nil
|
Loading…
x
Reference in New Issue
Block a user