Календарь: кнопки не налезают, без прозрачности, круглые, с учётом длинных месяцев
- RowLayout spacing 4, ToolButton 32x32 Layout.preferred 32, background Rectangle color Theme.surface (не прозрачный) + hover Theme.surfaceHover + pressed Theme.surfaceSelected, border Theme.border/Strong/accent, radius 16, contentItem Label - Label месяца: Layout.minimumWidth 80 preferred 120 fillWidth, elide Right, maximumLineCount 1, NoWrap, pixelSize 12, bold, для 'сентябрь 2026' (8 букв) и узких окон - Hover/pressed визуально меняются, круглые
This commit is contained in:
@@ -36,26 +36,88 @@ Item {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
spacing: 4
|
||||||
|
// Кнопка Назад — круглая, без прозрачности
|
||||||
ToolButton {
|
ToolButton {
|
||||||
text: "‹"
|
text: "‹"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
|
font.bold: true
|
||||||
|
implicitWidth: 32
|
||||||
|
implicitHeight: 32
|
||||||
|
Layout.preferredWidth: 32
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
background: Rectangle {
|
||||||
|
color: parent.pressed ? Theme.surfaceSelected : (parent.hovered ? Theme.surfaceHover : Theme.surface)
|
||||||
|
border.color: parent.pressed ? Theme.accent : (parent.hovered ? Theme.borderStrong : Theme.border)
|
||||||
|
radius: 16
|
||||||
|
}
|
||||||
|
contentItem: Label {
|
||||||
|
text: parent.text
|
||||||
|
font: parent.font
|
||||||
|
color: Theme.text
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
onClicked: cal.currentMonth = new Date(year, month - 1, 1)
|
onClicked: cal.currentMonth = new Date(year, month - 1, 1)
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumWidth: 80
|
||||||
|
Layout.preferredWidth: 120
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: Theme.text
|
color: Theme.text
|
||||||
|
font.pixelSize: 12
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
text: Qt.locale().monthName(month, Locale.LongFormat) + " " + year
|
text: Qt.locale().monthName(month, Locale.LongFormat) + " " + year
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
text: "›"
|
text: "›"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
|
font.bold: true
|
||||||
|
implicitWidth: 32
|
||||||
|
implicitHeight: 32
|
||||||
|
Layout.preferredWidth: 32
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
background: Rectangle {
|
||||||
|
color: parent.pressed ? Theme.surfaceSelected : (parent.hovered ? Theme.surfaceHover : Theme.surface)
|
||||||
|
border.color: parent.pressed ? Theme.accent : (parent.hovered ? Theme.borderStrong : Theme.border)
|
||||||
|
radius: 16
|
||||||
|
}
|
||||||
|
contentItem: Label {
|
||||||
|
text: parent.text
|
||||||
|
font: parent.font
|
||||||
|
color: Theme.text
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
onClicked: cal.currentMonth = new Date(year, month + 1, 1)
|
onClicked: cal.currentMonth = new Date(year, month + 1, 1)
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
text: "\u2302"
|
text: "\u2302"
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
|
implicitWidth: 32
|
||||||
|
implicitHeight: 32
|
||||||
|
Layout.preferredWidth: 32
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
background: Rectangle {
|
||||||
|
color: parent.pressed ? Theme.surfaceSelected : (parent.hovered ? Theme.surfaceHover : Theme.surface)
|
||||||
|
border.color: parent.pressed ? Theme.accent : (parent.hovered ? Theme.borderStrong : Theme.border)
|
||||||
|
radius: 16
|
||||||
|
}
|
||||||
|
contentItem: Label {
|
||||||
|
text: parent.text
|
||||||
|
font: parent.font
|
||||||
|
color: Theme.text
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
ToolTip.text: qsTr("Сегодня")
|
ToolTip.text: qsTr("Сегодня")
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
onClicked: cal.currentMonth = new Date()
|
onClicked: cal.currentMonth = new Date()
|
||||||
|
|||||||
Reference in New Issue
Block a user