[utilities/kalk] src/qml: qml/HistoryView: fix button size and label
Devin Lin <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 9ae0925179915cf067c77c9027c0cbf705769e30 by Devin Lin, on behalf of Christoph Wolk.
Committed on 06/08/2026 at 02:39.
Pushed by devinlin into branch 'master'.
qml/HistoryView: fix button size and label
This change fixes some issues in the HistoryView:
- Looking up the ListView by id fails, as it finds the RoundedDelegate
property instead, which is ListViewAttached, not ListView, and so does
not have width. As a consequence, the maximum size setting does not
work and a long input will push out the other buttons. Instead, set
ComponentBehavior: Bound to prefer local ids.
- The button labels are not vertically centered, so they are
significantly offset from the equals sign, which is rather confusing.
Instead, vertically center them to get easily readable lines
- QQC2's button may not have built-in padding (e.g. in desktop-style),
so replacing the contentItem will place it at the left border,
overlapping the button's on-hover highlight, which looks bad. Instead,
add a mediumSpacing to the left and right, which gives it a little
separation while still not reducing the amount of data that can be
displayed by much.
M +8 -0 src/qml/HistoryView.qml
https://invent.kde.org/utilities/kalk/-/commit/9ae0925179915cf067c77c9027c0cbf705769e30
diff --git a/src/qml/HistoryView.qml b/src/qml/HistoryView.qml
index f6ce7ef..db505fc 100644
--- a/src/qml/HistoryView.qml
+++ b/src/qml/HistoryView.qml
@@ -4,6 +4,8 @@
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+pragma ComponentBehavior: Bound
+
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
@@ -72,10 +74,13 @@ Kirigami.ScrollablePage {
}
}
contentItem: Label {
+ leftPadding: Kirigami.Units.mediumSpacing
+ rightPadding: Kirigami.Units.mediumSpacing
font.weight: Font.Light
font.pointSize: listView.flexPointSize || Kirigami.Theme.defaultFont.pointSize
text: item.parts[0].trim()
elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
}
ToolTip.visible: contentItem.truncated && hovered
@@ -102,10 +107,13 @@ Kirigami.ScrollablePage {
}
}
contentItem: Label {
+ leftPadding: Kirigami.Units.mediumSpacing
+ rightPadding: Kirigami.Units.mediumSpacing
font.weight: Font.Light
font.pointSize: listView.flexPointSize || Kirigami.Theme.defaultFont.pointSize
text: item.parts[1].trim()
elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
}
ToolTip.visible: contentItem.truncated && hovered