Added a new custom Button component

This commit is contained in:
2025-02-08 01:17:11 +02:00
parent d479a5e242
commit 1793f5b949
3 changed files with 41 additions and 11 deletions

View 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") }
}
}

View File

@ -21,6 +21,7 @@ qt_add_qml_module(appProject-Orion
SOURCES userlist.h userlist.cpp SOURCES userlist.h userlist.cpp
SOURCES serialization.h SOURCES serialization.h
SOURCES serialization.cpp SOURCES serialization.cpp
QML_FILES Button.qml
) )
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.

View File

@ -4,20 +4,16 @@ Window {
width: 640 width: 640
height: 480 height: 480
visible: true visible: true
title: qsTr("Lifespan viewer") title: "Lifespan viewer"
minimumWidth: 200 minimumWidth: 200
minimumHeight: 150 minimumHeight: 150
Rectangle { SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
Text { color: myPalette.window
id: emptyText
anchors.verticalCenter: parent.verticalCenter Button
anchors.horizontalCenter: parent.horizontalCenter {
text: qsTr("This view is currently empty :(") text: "For testing purposes"
height: parent.height
}
} }
} }