style: format

This commit is contained in:
talksik
2025-04-13 13:11:27 -07:00
parent eb59ff6430
commit 0a1f523128
2 changed files with 115 additions and 102 deletions
+92 -92
View File
@@ -3,101 +3,101 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
Rectangle { Rectangle {
id: warningAlert id: warningAlert
// Customizable properties // Customizable properties
property string alertTitle: "Warning" property string alertTitle: "Warning"
property string alertMessage: "This is a warning message about a dangerous operation." property string alertMessage: "This is a warning message about a dangerous operation."
property bool showIcon: true property bool showIcon: true
property bool closable: true property bool closable: true
property bool showTitle: true property bool showTitle: true
// Size properties // Size properties
implicitHeight: contentLayout.implicitHeight + 24 // Padding implicitHeight: contentLayout.implicitHeight + 24 // Padding
radius: Theme.radius radius: Theme.radius
// Warning style colors - already had these // Warning style colors - already had these
color: "#fffbe6" // Light yellow background color: "#fffbe6" // Light yellow background
border.color: "#ffe58f" // Yellow border border.color: "#ffe58f" // Yellow border
border.width: 1 border.width: 1
RowLayout { RowLayout {
id: contentLayout id: contentLayout
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: parent.top top: parent.top
margins: 12 margins: 12
}
spacing: 12
// Warning icon
Rectangle {
id: iconContainer
visible: showIcon
width: 16
height: 16
color: "transparent"
Text {
anchors.centerIn: parent
text: "⚠️"
font.pixelSize: 16
color: "#faad14"
}
}
// Content area
ColumnLayout {
Layout.fillWidth: true
spacing: 4
// Title
Text {
id: titleText
visible: showTitle
text: alertTitle
font.bold: true
font.pixelSize: 14
color: "#613400"
}
// Message
Text {
id: messageText
text: alertMessage
wrapMode: Text.WordWrap
Layout.fillWidth: true
color: "#613400"
font.pixelSize: 12
}
}
// Close button
Rectangle {
id: closeButton
visible: closable
width: 16
height: 16
color: "transparent"
Text {
anchors.centerIn: parent
text: "×"
font.pixelSize: 16
color: "#613400"
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: warningAlert.visible = false
// Hover effect
hoverEnabled: true
onEntered: closeButton.color = "#ffeeb5"
onExited: closeButton.color = "transparent"
}
}
} }
spacing: 12
// Warning icon
Rectangle {
id: iconContainer
visible: showIcon
width: 16
height: 16
color: "transparent"
Text {
anchors.centerIn: parent
text: "⚠️"
font.pixelSize: 16
color: "#faad14"
}
}
// Content area
ColumnLayout {
Layout.fillWidth: true
spacing: 4
// Title
Text {
id: titleText
visible: showTitle
text: alertTitle
font.bold: true
font.pixelSize: 14
color: "#613400"
}
// Message
Text {
id: messageText
text: alertMessage
wrapMode: Text.WordWrap
Layout.fillWidth: true
color: "#613400"
font.pixelSize: 12
}
}
// Close button
Rectangle {
id: closeButton
visible: closable
width: 16
height: 16
color: "transparent"
Text {
anchors.centerIn: parent
text: "×"
font.pixelSize: 16
color: "#613400"
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: warningAlert.visible = false
// Hover effect
hoverEnabled: true
onEntered: closeButton.color = "#ffeeb5"
onExited: closeButton.color = "transparent"
}
}
}
} }
+23 -10
View File
@@ -122,25 +122,38 @@ AppWindow {
} }
AppWarning { AppWarning {
Layout.fillWidth: true Layout.fillWidth: true
} }
AppMenu { AppMenu {
id: menu id: menu
Action { text: qsTr("Tool Bar"); checkable: true } Action {
Action { text: qsTr("Side Bar"); checkable: true; checked: true } text: qsTr("Tool Bar")
Action { text: qsTr("Status Bar"); checkable: true; checked: true } checkable: true
}
Action {
text: qsTr("Side Bar")
checkable: true
checked: true
}
Action {
text: qsTr("Status Bar")
checkable: true
checked: true
}
MenuSeparator {} MenuSeparator {}
Action { text: "Hello" } Action {
text: "Hello"
}
// NOTE: MenuItem is not recommended as it isn't consistent with the menu theming. Please use Action until a fix is made. // NOTE: MenuItem is not recommended as it isn't consistent with the menu theming. Please use Action until a fix is made.
} }
AppSecondaryButton { AppSecondaryButton {
onClicked: menu.open() onClicked: menu.open()
text: "Open menu" text: "Open menu"
} }
} }
} }