Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
arnopaehler committed Jul 10, 2015
1 parent e20834e commit 4617ec4
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tests/Image.qml
@@ -0,0 +1,59 @@
import QtQuick 2.0;

Rectangle {
id: root
width: 600
height: 600
x: 50
y: 50
color: '#fcc'
border.width: 5
border.color: 'blue'
Image {
id: inner1
source: 'images/lizard.jpg'
scale: 0.75
fillMode: Image.PreserveAspectFit
anchors.fill: parent
Rectangle {
anchors.fill: caption
color: '#ddd'
}
Text {
id: caption
x: inner1.width - 400
y: inner1.height - 50
font.pointSize: 16
color: '#00d'
text: ' Lizard in Turkey - scale = ' + inner1.scale.toFixed(3)
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onClicked: {
if (mouse.button == Qt.LeftButton)
inner1.scale += 0.025
else
inner1.scale -= 0.025
}
onEntered: {
root.color = '#ccf'
}
onExited: {
root.color = '#fcc'
}
}
}
Text {
id: hint
y: root.height - 90
font.family: 'Consolas'
font.pointSize: 14
color: '#303'
anchors.horizontalCenter: root.horizontalCenter
text: '
Left Mouse Click: increase image scale
Right Mouse Click: decrease image scale'
}
}
117 changes: 117 additions & 0 deletions tests/ListView.qml
@@ -0,0 +1,117 @@
import QtQuick 2.4;
import QtQuick.Controls 1.4

Rectangle {
id: root
color: '#aab'
property string source1: 'images/go-next.png'
property string source2: 'images/go-previous.png'

ListModel {
id: Cities

ListElement {
name: 'San Diego'
country: 'USA'
locale: 'en_US'
tz: -480 }
ListElement {
name: 'New York'
country: 'USA'
locale: 'en_US'
tz: -300 }
ListElement {
name: 'Berlin'
country: 'Germany'
locale: 'de_DE'
tz: 60 }
ListElement {
name: 'Teheran'
country: 'Iran'
locale: 'fa_IR'
tz: 210 }
ListElement {
name: 'Perth'
country: 'Australia'
locale: 'en_AU'
tz: 480 }
ListElement {
name: 'Osaka'
country: 'Japan'
locale: 'jp_JP'
tz: 540 }
}

ListView {
model: Cities
orientation: Qt.Vertical
spacing: 5
delegate: Rectangle {
width: 125
height: 40
color: Cities.get(index).locale[0] == 'e' ? 'magenta' : 'lime'
border.width: 1
border.color: 'red'
Image {
id: image
source: Cities.get(index).locale[0] == 'e' ? root.source1 : root.source2
fillMode: Image.PreserveAspectFit
anchors.fill: parent
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
info.text = 'clicked in listview/main\nsource = ' + image.source
}
}
}
}

ListView {
model: Cities
orientation: Qt.Horizontal
x: 130
spacing: 5
delegate: Rectangle {
width: 125
height: 40
color: Cities.get(index).tz < 0 ? 'cyan' : 'lime'
border.width: 1
border.color: 'blue'
Text {
id: entryCities
anchors.centerIn: parent
text: Cities.get(index).name + ' ' + Cities.get(index).tz
}
MouseArea {
id: mCity
anchors.fill: parent
onClicked: {
var city = Cities.get(index)
info.text = 'CITY : ' + city.name +
'\n\ncountry : ' + city.country +
'\nlocale : ' + city.locale +
'\ntimezone : ' + city.tz
}
}
}
}

Rectangle {
id: reporter
x: 130
y: 46
width: 780
height: 229
color: '#aaf'
Text {
id: info
anchors.centerIn: parent
color: '777'
font.pointSize: 18
font.bold: true
text: 'Your text could be here'
}
}
}
36 changes: 36 additions & 0 deletions tests/Rectangle.qml
@@ -0,0 +1,36 @@
import QtQuick 2.0;

Rectangle {
id: root
width: 520
height: 300
x: 200
y: 200
color: '#ccf'
border.width: 25
border.color: 'magenta'
Rectangle {
id: inner1
width: 100
height: 100
x: 100
y: 100
color: 'red'
}
Rectangle {
id: inner2
width: 100
height: 100
x: 210
y: 100
color: 'green'
}
Rectangle {
id: inner3
width: 100
height: 100
x: 320
y: 100
color: 'blue'
}
}
23 changes: 23 additions & 0 deletions tests/Text.qml
@@ -0,0 +1,23 @@
import QtQuick 2.0;

Rectangle {
id: root
width: 610
height: 200
x: 200
y: 200
color: '#cfc'
border.width: 15
border.color: 'blue'
Text {
id: inner1
anchors.centerIn: root
font.pointSize: 18
text:
'<b>Gallia</b> est omnis divisa <i>in partes tres</i>,
quarum unam incolunt <u>Belgae</u>, aliam <u>Aquitani</u>,
tertiam qui ipsorum lingua <u>Celtae</u>, nostra <u>Galli</u>
appellantur. Hi omnes lingua, institutis,
legibus inter se differunt.'
}
}
Binary file added tests/images/go-next.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/go-previous.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/lizard.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4617ec4

Please sign in to comment.