File tree Expand file tree Collapse file tree 12 files changed +234
-0
lines changed Expand file tree Collapse file tree 12 files changed +234
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ Xvfb :1 -screen 0 1024x768x24 +extension RANDR +extension RENDER +extension GLX &
3+ export DISPLAY=:1
Original file line number Diff line number Diff line change 1+ TEMPLATE = subdirs
2+ SUBDIRS += \
3+ src \
4+ test_runner
5+
6+ test_runner.depends = src
Original file line number Diff line number Diff line change 1+ import QtQuick 2.9
2+ import QtQuick.Dialogs 1.1
3+ import QtQuick.Controls 1.0
4+
5+ Item {
6+ id: clicker
7+ anchors .fill : parent
8+
9+ property int click: 0
10+ property alias status: clickerText
11+ property string clickedType : " Generic"
12+
13+ Image {
14+ id: image
15+ anchors .fill : parent
16+ fillMode: Image .PreserveAspectFit
17+ source: " qrc:/smile.png"
18+
19+ MouseArea {
20+ anchors .fill : parent
21+
22+ onClicked: {
23+ click++ ;
24+ }
25+ }
26+ }
27+
28+ Text {
29+ anchors .horizontalCenter : parent .horizontalCenter
30+ id: clickerText
31+ x: 0
32+ y: 0
33+ text: clickedType + " s clicked: " + click;
34+ color: " brown"
35+ font .pixelSize : 30
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ #include < QGuiApplication>
2+ #include < QQmlApplicationEngine>
3+
4+ int main (int argc, char *argv[])
5+ {
6+ QCoreApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
7+
8+ QGuiApplication app (argc, argv);
9+
10+ QQmlApplicationEngine engine;
11+ engine.load (QUrl (QStringLiteral (" qrc:/main.qml" )));
12+ if (engine.rootObjects ().isEmpty ())
13+ return -1 ;
14+ return app.exec ();
15+ }
Original file line number Diff line number Diff line change 1+ import QtQuick 2.0
2+ import QtQuick.Window 2.2
3+
4+ Window {
5+ id: window
6+ width: 620
7+ visible: true
8+ height: 420
9+ title: qsTr (" Smiley clicker!" )
10+
11+ Clicker {
12+ clickedType: " Smiley"
13+ width: 350
14+ height: 200
15+ anchors .centerIn : parent
16+ }
17+
18+ }
Original file line number Diff line number Diff line change 1+ <RCC>
2+ <qresource prefix="/">
3+ <file>main.qml</file>
4+ <file>Clicker.qml</file>
5+ <file>smile.png</file>
6+ </qresource>
7+ </RCC>
Original file line number Diff line number Diff line change 1+ QT += quick
2+ TARGET = clicker
3+ CONFIG += c++11
4+
5+ # The following define makes your compiler emit warnings if you use
6+ # any feature of Qt which as been marked deprecated (the exact warnings
7+ # depend on your compiler). Please consult the documentation of the
8+ # deprecated API in order to know how to port your code away from it.
9+ DEFINES += QT_DEPRECATED_WARNINGS
10+
11+ # You can also make your code fail to compile if you use deprecated APIs.
12+ # In order to do so, uncomment the following line.
13+ # You can also select to disable deprecated APIs only up to a certain version of Qt.
14+ # DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15+
16+ SOURCES += main.cpp
17+
18+ RESOURCES += qml.qrc
19+
20+ OTHER_FILES += \
21+ Clicker.qml \
22+ main.qml \
23+ smile.png
24+
25+ # Additional import path used to resolve QML modules in Qt Creator's code model
26+ QML_IMPORT_PATH =
27+
28+ # Additional import path used to resolve QML modules just for Qt Quick Designer
29+ QML_DESIGNER_IMPORT_PATH =
30+
31+ # Default rules for deployment.
32+ qnx: target.path = /tmp/ $${TARGET }/bin
33+ else: unix :!android: target.path = /opt/ $${TARGET }/bin
34+ !isEmpty (target.path ): INSTALLS += target
Original file line number Diff line number Diff line change 1+ import QtQuick 2.0
2+ import "../src" 1.00
3+
4+ Clicker {
5+ clickedType: " Click"
6+ width: 350
7+ height: 200
8+ anchors .centerIn : parent
9+ }
Original file line number Diff line number Diff line change 1+ TEMPLATE = app
2+ TARGET = tst_clicker
3+ QT += quick core testlib
4+ CONFIG += c++11 warn_on qmltestcase
5+ CONFIG -= app_bundle
6+
7+ # The following define makes your compiler emit warnings if you use
8+ # any feature of Qt which as been marked deprecated (the exact warnings
9+ # depend on your compiler). Please consult the documentation of the
10+ # deprecated API in order to know how to port your code away from it.
11+ DEFINES += QT_DEPRECATED_WARNINGS
12+
13+ # You can also make your code fail to compile if you use deprecated APIs.
14+ # In order to do so, uncomment the following line.
15+ # You can also select to disable deprecated APIs only up to a certain version of Qt.
16+ # DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17+
18+ SOURCES += tst_clicker.cpp
19+
20+ RESOURCES += \
21+ $$PWD /../src/qml.qrc
22+
23+ INCLUDEPATH += $$PWD /../src
24+
25+ # Additional import path used to resolve QML modules in Qt Creator's code model
26+ QML2_IMPORT_PATH = $$PWD /../src/qml.qrc
27+
28+ # Additional import path used to resolve QML modules just for Qt Quick Designer
29+ QML_DESIGNER_IMPORT_PATH =
30+
31+ # Default rules for deployment.
32+ qnx: target.path = /tmp/ $${TARGET }/bin
33+ else: unix :!android: target.path = /opt/ $${TARGET }/bin
34+ !isEmpty (target.path ): INSTALLS += target
35+
36+ OTHER_FILES += \
37+ tst_clicker.qml \
38+ ClickerTest.qml
You can’t perform that action at this time.
0 commit comments