Warning, /frameworks/kirigami/src/controls/Card.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Layouts 0009 import QtQuick.Controls as QQC2 0010 import org.kde.kirigami as Kirigami 0011 import "private" as P 0012 0013 /** 0014 * @brief This is the standard layout of a Card. 0015 * 0016 * It is recommended to use this class when the concept of Cards is needed 0017 * in the application. 0018 * 0019 * This Card has default items as header and footer. The header is an 0020 * image that can contain an optional title and icon, accessible via the 0021 * banner grouped property. 0022 * 0023 * The footer will show a series of toolbuttons (and eventual overflow menu) 0024 * representing the actions list accessible with the list property actions. 0025 * It is possible even tough is discouraged to override the footer: 0026 * in this case the actions property shouldn't be used. 0027 * 0028 * @inherit org::kde::kirigami::AbstractCard 0029 * @since 2.4 0030 */ 0031 Kirigami.AbstractCard { 0032 id: root 0033 0034 /** 0035 * @brief This property holds the clickable actions that will be available in the footer 0036 * of the card. 0037 * 0038 * The actions will be represented by a list of ToolButtons with an optional overflow 0039 * menu, when not all of them will fit in the available Card width. 0040 * 0041 * @property list<org::kde::kirigami::Action> Card::actions 0042 */ 0043 property list<QtObject> actions 0044 0045 /** 0046 * @brief This grouped property controls the banner image present in the header. 0047 * 0048 * This grouped property has the following sub-properties: 0049 * * ``source: url``: The source for the image. It understands any URL valid for an Image component. 0050 * * ``titleIcon: string``: The optional icon to put in the banner, either a freedesktop-compatible 0051 * icon name (recommended) or any URL supported by QtQuick.Image. 0052 * * ``title: string``: The title for the banner, shown as contrasting text over the image. 0053 * * ``titleAlignment: Qt::Alignment``: The alignment of the title inside the image. 0054 * default: ``Qt.AlignTop | Qt.AlignLeft`` 0055 * * ``titleLevel: int``: The Kirigami.Heading level for the title, which controls the font size. 0056 * default: ``1``, which is the largest size. 0057 * * ``titleWrapMode: QtQuick.Text::wrapMode``: Whether the header text should be able to wrap. 0058 * default: ``Text.NoWrap`` 0059 * 0060 * It also has the full set of properties that QtQuick.Image has, such as sourceSize and fillMode. 0061 * 0062 * @see org::kde::kirigami::private::BannerImage 0063 * @property Image banner 0064 */ 0065 readonly property alias banner: bannerImage 0066 0067 0068 header: Kirigami.Padding { 0069 leftPadding: -root.leftPadding + root.background.border.width 0070 topPadding: -root.topPadding + root.background.border.width 0071 rightPadding: -root.rightPadding + root.background.border.width 0072 bottomPadding: root.contentItem ? 0: -root.bottomPadding + root.background.border.width 0073 contentItem: P.BannerImage { 0074 id: bannerImage 0075 implicitWidth: Layout.preferredWidth 0076 implicitHeight: (source.toString().length > 0 && sourceSize.width > 0 && sourceSize.height > 0 ? width / (sourceSize.width / sourceSize.height) : Layout.minimumHeight) + parent.topPadding + parent.bottomPadding 0077 0078 readonly property real widthWithBorder: width + root.background.border.width * 2 0079 readonly property real heightWithBorder: height + root.background.border.width * 2 0080 readonly property real radiusFromBackground: root.background.radius - root.background.border.width 0081 0082 corners.topLeftRadius: radiusFromBackground 0083 corners.topRightRadius: radiusFromBackground 0084 corners.bottomLeftRadius: radiusFromBackground 0085 corners.bottomRightRadius: heightWithBorder < root.height ? 0 : radiusFromBackground 0086 0087 checkable: root.checkable 0088 checked: root.checkable && root.checked 0089 onToggled: (checked) => { 0090 root.checked = checked 0091 } 0092 } 0093 } 0094 0095 onHeaderChanged: { 0096 if (!header) { 0097 return; 0098 } 0099 0100 header.anchors.leftMargin = Qt.binding(() => -root.leftPadding); 0101 header.anchors.topMargin = Qt.binding(() => -root.topPadding); 0102 header.anchors.rightMargin = Qt.binding(() => -root.rightPadding); 0103 header.anchors.bottomMargin = Qt.binding(() => 0); 0104 } 0105 0106 footer: Kirigami.ActionToolBar { 0107 id: actionsToolBar 0108 actions: root.actions 0109 position: QQC2.ToolBar.Footer 0110 visible: root.footer === actionsToolBar 0111 } 0112 }