Browse Source

Add QtQuickControls2Application test

master
probonopd 8 years ago
parent
commit
d570e15c20
  1. 7
      tests/QtQuickControls2Application/Page1.qml
  2. 24
      tests/QtQuickControls2Application/Page1Form.ui.qml
  3. 29
      tests/QtQuickControls2Application/QtQuickControls2Application.pro
  4. 13
      tests/QtQuickControls2Application/main.cpp
  5. 37
      tests/QtQuickControls2Application/main.qml
  6. 8
      tests/QtQuickControls2Application/qml.qrc
  7. 15
      tests/QtQuickControls2Application/qtquickcontrols2.conf
  8. 39
      tests/tests.sh

7
tests/QtQuickControls2Application/Page1.qml

@ -0,0 +1,7 @@
import QtQuick 2.7
Page1Form {
button1.onClicked: {
console.log("Button Pressed. Entered text: " + textField1.text);
}
}

24
tests/QtQuickControls2Application/Page1Form.ui.qml

@ -0,0 +1,24 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
Item {
property alias textField1: textField1
property alias button1: button1
RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 20
anchors.top: parent.top
TextField {
id: textField1
placeholderText: qsTr("Text Field")
}
Button {
id: button1
text: qsTr("Press Me")
}
}
}

29
tests/QtQuickControls2Application/QtQuickControls2Application.pro

@ -0,0 +1,29 @@
QT += qml quick
CONFIG += c++11
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 =
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use 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
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

13
tests/QtQuickControls2Application/main.cpp

@ -0,0 +1,13 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
return app.exec();
}

37
tests/QtQuickControls2Application/main.qml

@ -0,0 +1,37 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
Page1 {
}
Page {
Label {
text: qsTr("Second page")
anchors.centerIn: parent
}
}
}
footer: TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
TabButton {
text: qsTr("First")
}
TabButton {
text: qsTr("Second")
}
}
}

8
tests/QtQuickControls2Application/qml.qrc

@ -0,0 +1,8 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Page1.qml</file>
<file>Page1Form.ui.qml</file>
<file>qtquickcontrols2.conf</file>
</qresource>
</RCC>

15
tests/QtQuickControls2Application/qtquickcontrols2.conf

@ -0,0 +1,15 @@
; This file can be edited to change the style of the application
; See Styling Qt Quick Controls 2 in the documentation for details:
; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html
[Controls]
Style=Default
[Universal]
Theme=Light
;Accent=Steel
[Material]
Theme=Light
;Accent=BlueGrey
;Primary=BlueGray

39
tests/tests.sh

@ -1,13 +1,15 @@
#!/bin/bash #!/bin/bash
# Build the sample Qt Widgets Application that comes with Qt Creator
# Workaround for: # Workaround for:
# https://github.com/probonopd/linuxdeployqt/issues/65 # https://github.com/probonopd/linuxdeployqt/issues/65
unset QT_PLUGIN_PATH unset QT_PLUGIN_PATH
unset LD_LIBRARY_PATH unset LD_LIBRARY_PATH
unset QTDIR unset QTDIR
###############################################################################
# Build the sample Qt Widgets Application that comes with Qt Creator
###############################################################################
cd tests/QtWidgetsApplication/ cd tests/QtWidgetsApplication/
if [ -e build/ ] ; then if [ -e build/ ] ; then
rm -rf build/ rm -rf build/
@ -36,3 +38,36 @@ sleep 10
killall QtWidgetsApplication && echo "SUCCESS" killall QtWidgetsApplication && echo "SUCCESS"
cd ../../../ cd ../../../
###############################################################################
# Build the sample Qt Quick Controls 2 Application that comes with Qt Creator
###############################################################################
cd tests/QtQuickControls2Application/
if [ -e build/ ] ; then
rm -rf build/
fi
mkdir build
cd build/
qmake ../QtQuickControls2Application.pro
make -j2
rm *.o *.cpp *.h Makefile
mkdir -p nonfhs fhs/usr/bin
cp QtQuickControls2Application nonfhs/
../../../linuxdeployqt-*-x86_64.AppImage nonfhs/QtQuickControls2Application -qmldir=../
ldd nonfhs/QtWidgetsApplication
find nonfhs/
LD_DEBUG=libs nonfhs/QtQuickControls2Application &
sleep 10
killall QtQuickControls2Application && echo "SUCCESS"
cp QtQuickControls2Application fhs/usr/bin/
../../../linuxdeployqt-*-x86_64.AppImage fhs/usr/bin/QtQuickControls2Application -qmldir=../
ldd fhs/usr/bin/QtQuickControls2Application
find fhs/
LD_DEBUG=libs fhs/usr/bin/QtQuickControls2Application &
sleep 10
killall QtQuickControls2Application && echo "SUCCESS"
cd ../../../

Loading…
Cancel
Save