KNewStuff

MessageBoxSheet.qml
1 /*
2  SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.12
8 import QtQuick.Controls 2.12 as QtControls
9 import QtQuick.Layouts 1.12 as QtLayouts
10 
11 import org.kde.kirigami 2.7 as Kirigami
12 
13 Kirigami.OverlaySheet {
14  id: component
15 
16  property alias title: headerLabel.text
17  property alias text: messageLabel.text
18  property list<QtObject> actions
19 
20  showCloseButton: true
21  header: Kirigami.Heading {
22  id: headerLabel
23  QtLayouts.Layout.fillWidth: true
24  elide: Text.ElideRight
25  }
26  // This is a TextEdit rather than a label, because the QQC Label control
27  // does not support text selection (and it's very useful to be able to
28  // select error texts for searchy purposes)
29  contentItem: TextEdit {
30  id: messageLabel
31  QtLayouts.Layout.preferredWidth: Kirigami.Units.gridUnit * 10
32  QtLayouts.Layout.margins: Kirigami.Units.largeSpacing
33  wrapMode: Text.Wrap
34  readOnly: true
35  selectByMouse: true
36  color: Kirigami.Theme.textColor
37  selectedTextColor: Kirigami.Theme.highlightedTextColor
38  selectionColor: Kirigami.Theme.highlightColor
39  }
40  footer: QtLayouts.RowLayout {
41  Item { QtLayouts.Layout.fillWidth: true }
42  Repeater {
43  model: component.actions;
44  QtControls.Button {
45  action: modelData
46  Connections {
47  target: action
48  onTriggered: component.close()
49  }
50  }
51  }
52  }
53 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.