blob: 4307cd510ac422112bd8085fb53a959fdb9d956a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls.Basic
ItemDelegate {
id: root
property alias source: root.icon.source
property bool selected: false
readonly property int iconSize: availableHeight - root.font.pixelSize - spacing
// Pick an implicit height in such way that the icon has twice more space
// then the text
implicitHeight: topPadding + bottomPadding + spacing + 3 * root.font.pixelSize
icon.height: iconSize
icon.width: iconSize
icon.color: selected ? Theme.iconSelected : Theme.iconNormal
palette.text: selected ? Theme.iconTextSelected : Theme.iconTextNormal
display: AbstractButton.TextUnderIcon
font.pixelSize: Theme.smallFontSize
font.weight: Theme.fontDefaultWeight
background: Rectangle {
color: "transparent"
}
}
|