A lot of changes and additions...

This commit is contained in:
Oscar Andreasson 2015-11-16 09:27:06 +01:00
parent 5ba0bf9738
commit 25f889bef8
7 changed files with 201 additions and 16 deletions

View file

@ -6,10 +6,11 @@ import QtQuick.Controls.Styles 1.2
Rectangle {
id: root
width: 360
// width: 360
// height: 700
color: "black"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
ListView {
anchors.fill: parent
@ -58,12 +59,21 @@ Rectangle {
width: root.width
Text {
id: textElement
anchors.verticalCenter: parent.verticalCenter
x: 15
x: 5
font.pixelSize: 24
color: "white"
text: owner
}
Rectangle {
anchors.top: textElement.bottom
width: textElement.width
height: 2
x: 5
color: "white"
}
Component.onCompleted: {
calendarEntryModel.setProperty(index, "collapsed", !collapsed)
}
@ -98,10 +108,10 @@ Rectangle {
Text {
anchors.verticalCenter: parent.verticalCenter
x: 30
x: 0
font.pixelSize: 18
color: "white"
text: time + " " + heading
text: time + "\t" + heading
}
}
}

View file

@ -11,10 +11,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import QtQuick.Window 2.0
Rectangle {
width: 360
height: 160
color: "#000000"
MirrorWindow {
property date currDate: new Date()
Timer {
@ -32,13 +29,15 @@ Rectangle {
font.pointSize: 48
font.family: "Helvetica"
color: "#ffffff"
anchors.horizontalCenter: parent.horizontalCenter
//anchors.horizontalCenter: parent.horizontalCenter
x: 5
}
Text {
id: datum
anchors.top: time.bottom
anchors.horizontalCenter: parent.horizontalCenter
//anchors.horizontalCenter: parent.horizontalCenter
x: 5
font.pointSize: 24
color: "#ffffff"
font.family: "Helvetica"

10
MirrorText.qml Normal file
View file

@ -0,0 +1,10 @@
import QtQuick 2.0
Text {
id: time
anchors.top: parent.top
font.pointSize: 48
font.family: "Helvetica"
color: "#ffffff"
//anchors.horizontalCenter: parent.horizontalCenter
}

12
MirrorWindow.qml Normal file
View file

@ -0,0 +1,12 @@
import QtQuick 2.0
Rectangle {
width: 360*windowWidth
height: 160*windowHeight
color: "#000000"
property int windowHeight: 1
property int windowWidth: 1
}

View file

@ -6,18 +6,22 @@
# Copyright (c) 2015 Oscar Andreasson
#
TEMPLATE = subdirs
TEMPLATE = app
SUBDIRS = weatherinfo
OTHER_FILES = \
LICENSE
SOURCES = QmlMirror.qml \
DISTFILES += \
TaskWarrior.qml \
QmlMirror.qml \
Clock.qml \
Weather.qml \
Transport.qml \
Position.qml \
Main.qml \
Calendar.qml
OTHER_FILES = \
LICENSE
Calendar.qml \
lala.qml \
MirrorText.qml \
MirrorWindow.qml

31
TaskWarrior.qml Normal file
View file

@ -0,0 +1,31 @@
import QtQuick 2.2
//import net.frozentux.qmlcomponents 1.0
Rectangle {
id: root
anchors.fill: parent
color: "white"
property string fileName: "jsondata.txt"
JSONListModel {
id: jsonModel
source: "jsondata.txt"
}
ListView {
id: jsonView
anchors.fill: parent
model: jsonModel.model
delegate: Text {
text: model.description
Component.onCompleted: {
console.log("Text: " + text)
}
}
}
}

119
lala.qml Normal file
View file

@ -0,0 +1,119 @@
import QtQuick 2.0
Item {
// width: 200
// height: 700
ListView {
anchors.fill: parent
model: nestedModel
delegate: categoryDelegate
}
ListModel {
id: nestedModel
ListElement {
categoryName: "Veggies"
collapsed: true
// A ListElement can't contain child elements, but it can contain
// a list of elements. A list of ListElements can be used as a model
// just like any other model type.
subItems: [
ListElement { itemName: "Tomato" },
ListElement { itemName: "Cucumber" },
ListElement { itemName: "Onion" },
ListElement { itemName: "Brains" }
]
}
ListElement {
categoryName: "Fruits"
collapsed: true
subItems: [
ListElement { itemName: "Orange" },
ListElement { itemName: "Apple" },
ListElement { itemName: "Pear" },
ListElement { itemName: "Lemon" }
]
}
ListElement {
categoryName: "Cars"
collapsed: true
subItems: [
ListElement { itemName: "Nissan" },
ListElement { itemName: "Toyota" },
ListElement { itemName: "Chevy" },
ListElement { itemName: "Audi" }
]
}
}
Component {
id: categoryDelegate
Column {
width: 200
Rectangle {
id: categoryItem
border.color: "black"
border.width: 5
color: "white"
height: 50
width: 200
Text {
anchors.verticalCenter: parent.verticalCenter
x: 15
font.pixelSize: 24
text: categoryName
Component.onCompleted: {
nestedModel.setProperty(index, "collapsed", !collapsed)
}
}
}
Loader {
id: subItemLoader
// This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null
// the Loader element retains the same height it had when sourceComponent was set. Setting visible
// to false makes the parent Column treat it as if it's height was 0.
visible: !collapsed
property variant subItemModel : subItems
sourceComponent: collapsed ? null : subItemColumnDelegate
onStatusChanged: if (status == Loader.Ready) item.model = subItemModel
}
}
}
Component {
id: subItemColumnDelegate
Column {
property alias model : subItemRepeater.model
width: 200
Repeater {
id: subItemRepeater
delegate: Rectangle {
color: "#cccccc"
height: 40
width: 200
border.color: "black"
border.width: 2
Text {
anchors.verticalCenter: parent.verticalCenter
x: 30
font.pixelSize: 18
text: itemName
}
}
}
}
}
}