Créez votre famille de boutons

main
Alexis Drai 2 years ago
parent 3a52ac8538
commit a0a4f9e075

@ -0,0 +1,27 @@
// BigButton.qml:
import QtQuick 2.0
import Sailfish.Silica 1.0
Rectangle {
id: customButton
width: parent.width
height: Theme.itemSizeExtraLarge
color: Theme.secondaryHighlightColor
MouseArea {
anchors.fill: parent
onClicked: customButton.clicked()
}
signal clicked()
property alias buttonText: buttonText
Text {
id: buttonText
text: "Button Text"
font.pixelSize: Theme.fontSizeExtraLarge
color: Theme.primaryColor
anchors.centerIn: parent
}
}

@ -1,6 +1,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtQuick.Layouts 1.1
import "../components"
Page {
id: page
@ -83,9 +84,14 @@ Page {
}
}
Button {
text: qsTr("Quit")
onClicked: Qt.quit()
BigButton {
buttonText.text: "First Button"
onClicked: console.log("First Button clicked!")
}
BigButton {
buttonText.text: "Second Button"
onClicked: console.log("Second Button clicked!")
}
}
}

@ -17,6 +17,7 @@ CONFIG += sailfishapp
SOURCES += src/qt2.cpp
DISTFILES += qml/qt2.qml \
qml/components/BigButton.qml \
qml/cover/CoverPage.qml \
qml/pages/FirstPage.qml \
qml/pages/SecondPage.qml \

@ -22,10 +22,6 @@
<source>Argh</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quit</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SecondPage</name>

@ -22,10 +22,6 @@
<source>Argh</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quit</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SecondPage</name>

Loading…
Cancel
Save