KNewStuff

MessageBoxSheet.qml
1 /*
2  * Copyright 2020 Dan Leinir Turthra Jensen <[email protected]>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2 or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 import QtQuick 2.12
21 import QtQuick.Controls 2.12 as QtControls
22 import QtQuick.Layouts 1.12 as QtLayouts
23 
24 import org.kde.kirigami 2.7 as Kirigami
25 
26 Kirigami.OverlaySheet {
27  id: component
28 
29  property alias title: headerLabel.text
30  property alias text: messageLabel.text
31  property list<QtObject> actions
32 
33  showCloseButton: true
34  header: Kirigami.Heading {
35  id: headerLabel
36  QtLayouts.Layout.fillWidth: true
37  elide: Text.ElideRight
38  }
39  // This is a TextEdit rather than a label, because the QQC Label control
40  // does not support text selection (and it's very useful to be able to
41  // select error texts for searchy purposes)
42  contentItem: TextEdit {
43  id: messageLabel
44  QtLayouts.Layout.preferredWidth: Kirigami.Units.gridUnit * 10
45  QtLayouts.Layout.margins: Kirigami.Units.largeSpacing
46  wrapMode: Text.Wrap
47  readOnly: true
48  selectByMouse: true
49  color: Kirigami.Theme.textColor
50  selectedTextColor: Kirigami.Theme.highlightedTextColor
51  selectionColor: Kirigami.Theme.highlightColor
52  }
53  footer: QtLayouts.RowLayout {
54  Item { QtLayouts.Layout.fillWidth: true }
55  Repeater {
56  model: component.actions;
57  QtControls.Button {
58  action: modelData
59  Connections {
60  target: action
61  onTriggered: component.close()
62  }
63  }
64  }
65  }
66 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.