Last active
December 28, 2015 10:09
-
-
Save Gordi90/7484224 to your computer and use it in GitHub Desktop.
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
import QtQuick 2.0 | |
import QtQuick.Controls 1.0 | |
import QtQuick.LocalStorage 2.0 | |
Rectangle { | |
id: mainRectangle | |
width: 240 | |
height: 400 | |
color: "#6d9586" | |
} |
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
Rectangle{ | |
id: header | |
width: 240 | |
height: 50 | |
gradient: Gradient { | |
GradientStop { | |
position: 0 | |
color: "#013c1818" | |
} | |
GradientStop { | |
position: 0.86 | |
color: "#154215" | |
} | |
GradientStop { | |
position: 1 | |
color: "#000000" | |
} | |
} | |
anchors.top: parent.top | |
anchors.topMargin: 0 | |
anchors.horizontalCenter: parent.horizontalCenter | |
Text { | |
id: title | |
text: "Tennivalóim" | |
anchors.left: parent.left | |
anchors.leftMargin: 10 | |
anchors.verticalCenter: parent.verticalCenter | |
font.bold: true | |
font.pointSize: 15 | |
color: "#ffffff" | |
} | |
Button { | |
id: addButton | |
anchors.verticalCenter: parent.verticalCenter | |
width: 26 | |
height: 26 | |
text: "+" | |
anchors.right: parent.right | |
anchors.rightMargin: 10 | |
onClicked: PropertyAnimation { | |
target: newpage | |
property: "x"; | |
to: 0 | |
duration: 200; | |
} | |
} | |
} |
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
ListView { | |
id: todolist | |
x: 0 | |
y: 50 | |
width: parent.width | |
height: 350 | |
cacheBuffer: 317 | |
flickableDirection: Flickable.VerticalFlick | |
boundsBehavior: Flickable.DragOverBounds | |
smooth: true | |
clip: false | |
snapMode: ListView.SnapToItem | |
orientation: ListView.Vertical | |
delegate: Todo { name: todoName; priority: todoPriority} | |
model: todoListmodel | |
} |
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
ListModel { | |
id: todoListmodel | |
} |
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
function initDB() { | |
//identifier, version, description, estimated_size, callback(db) | |
var db = LocalStorage.openDatabaseSync("TodoDB", "1.0", function(db){ | |
console.log("Nincs még db"); | |
}); | |
db.transaction( | |
function(tx) { | |
// Create the database table if it doesn't already exist | |
console.log("Table create"); | |
tx.executeSql('CREATE TABLE IF NOT EXISTS todos (todo TEXT, priority INT NOT NULL, description TEXT)'); | |
//tx.executeSql('DROP TABLE todos'); | |
} | |
); | |
return db; | |
} |
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
function upDate() { | |
initDB().transaction( | |
function(tx) { | |
// Show all added todos | |
var rs = tx.executeSql('SELECT * from todos'); | |
console.log("Rows: " + rs.rows.length); | |
todoListmodel.clear(); | |
for(var i = 0; i < rs.rows.length; i++) { | |
todoListmodel.append({todoName: rs.rows.item(i).todo, todoPriority:rs.rows.item(i).priority }); | |
console.log("Item: " + i); | |
} | |
} | |
) | |
} |
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
NewPage{ | |
id:newpage | |
x: 240 | |
} |
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
Component.onCompleted: { | |
initDB(); | |
upDate(); | |
} |
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
PropertyAnimation { | |
id: hide | |
target: newpage | |
property: "x"; | |
to: 240 | |
duration: 200; | |
} |
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
function goBack(){ | |
radio_button1.checked = true; | |
radio_button2.checked = false; | |
radio_button3.checked = false; | |
todoNameInput.text = ""; | |
upDate(); | |
hide.start(); | |
} |
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
Text { | |
id: title2 | |
text: "Új tennivaló" | |
anchors.top: parent.top | |
anchors.topMargin: 10 | |
anchors.left: parent.left | |
anchors.leftMargin: 10 | |
font.bold: true | |
font.pointSize: 15 | |
} | |
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
Rectangle{ | |
id: rectangle1 | |
height: 20 | |
anchors.top: parent.top | |
anchors.topMargin: 100 | |
anchors.right: parent.right | |
anchors.rightMargin: 10 | |
anchors.left: parent.left | |
anchors.leftMargin: 10 | |
TextInput { | |
anchors.fill: parent | |
id: todoNameInput | |
color: "#000000" | |
anchors.topMargin: 0 | |
font.pointSize: 12 | |
} | |
} |
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
import QtQuick 2.0 | |
import QtQuick.Controls 1.0 | |
import QtQuick.LocalStorage 2.0 | |
Rectangle { | |
id:page2 | |
width: 240 | |
height: 400 | |
color: "#6d9586" | |
} |
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
import QtQuick 2.0 | |
Rectangle { | |
width: parent.width | |
height: 62 | |
property int priority; | |
property string name; | |
Rectangle { | |
id: priorityRect | |
x: 0 | |
y: 0 | |
width: 14 | |
height: parent.height | |
color: priority == 1 ? "#FF530D" : priority == 2 ? "#FFCF20" : "#339601" | |
} | |
Text { | |
id: todoName | |
x: 20 | |
y: 16 | |
width: 212 | |
height: 30 | |
font.pixelSize: 12 | |
text: name | |
verticalAlignment: Text.AlignVCenter | |
font.bold: true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment