Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e20834e
commit 4617ec4
Showing
7 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.' | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.