Added a new custom Button component
This commit is contained in:
33
src/Project-Orion/Button.qml
Normal file
33
src/Project-Orion/Button.qml
Normal file
@ -0,0 +1,33 @@
|
||||
import QtQuick
|
||||
|
||||
Rectangle {
|
||||
id: button
|
||||
property string text: "<placeholder>"
|
||||
|
||||
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
|
||||
|
||||
width: parent.width * 0.2
|
||||
height: parent.height * 0.2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: clickablearea.pressed ? "darkgrey" : "gray"
|
||||
radius: 4
|
||||
|
||||
Text
|
||||
{
|
||||
color: myPalette.buttonText
|
||||
text: button.text
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width * 0.8
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: clickablearea
|
||||
anchors.fill: parent
|
||||
onClicked: { console.error("Hehehe") }
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ qt_add_qml_module(appProject-Orion
|
||||
SOURCES userlist.h userlist.cpp
|
||||
SOURCES serialization.h
|
||||
SOURCES serialization.cpp
|
||||
QML_FILES Button.qml
|
||||
)
|
||||
|
||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||
|
@ -4,20 +4,16 @@ Window {
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true
|
||||
title: qsTr("Lifespan viewer")
|
||||
title: "Lifespan viewer"
|
||||
minimumWidth: 200
|
||||
minimumHeight: 150
|
||||
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
|
||||
|
||||
Text {
|
||||
id: emptyText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("This view is currently empty :(")
|
||||
height: parent.height
|
||||
}
|
||||
color: myPalette.window
|
||||
|
||||
Button
|
||||
{
|
||||
text: "For testing purposes"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user