• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

PlasmaComponents

  • sources
  • kde-4.14
  • kde-runtime
  • plasma
  • declarativeimports
  • plasmacomponents
  • qml
QueryDialog.qml
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Marco Martin <mart@kde.org>
4 **
5 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 ** All rights reserved.
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** This file is part of the Qt Components project.
10 **
11 ** $QT_BEGIN_LICENSE:BSD$
12 ** You may use this file under the terms of the BSD license as follows:
13 **
14 ** "Redistribution and use in source and binary forms, with or without
15 ** modification, are permitted provided that the following conditions are
16 ** met:
17 ** * Redistributions of source code must retain the above copyright
18 ** notice, this list of conditions and the following disclaimer.
19 ** * Redistributions in binary form must reproduce the above copyright
20 ** notice, this list of conditions and the following disclaimer in
21 ** the documentation and/or other materials provided with the
22 ** distribution.
23 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
24 ** the names of its contributors may be used to endorse or promote
25 ** products derived from this software without specific prior written
26 ** permission.
27 **
28 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42 
43 import QtQuick 1.1
44 import org.kde.plasma.extras 0.1 as PlasmaExtras
45 import "." 0.1
46 
47 CommonDialog {
48  id: root
49  objectName: "root"
50 
51  property string message
52  property string acceptButtonText: i18n("Ok")
53  property string rejectButtonText: i18n("Cancel")
54 
55  onAcceptButtonTextChanged: internal.updateButtonTexts()
56  onRejectButtonTextChanged: internal.updateButtonTexts()
57 
58  onButtonClicked: {
59  if (acceptButtonText && index == 0)
60  accept()
61  else
62  reject()
63  }
64 
65  content: Item {
66  implicitWidth: Math.max(theme.defaultFont.mSize.width * 15, Math.min(label.implicitWidth+12, theme.defaultFont.mSize.width * 25))
67 
68  implicitHeight: Math.min(theme.defaultFont.mSize.height * 12, label.paintedHeight + 6)
69 
70 
71  width: implicitWidth
72  height: implicitHeight
73 
74  PlasmaExtras.ScrollArea {
75  anchors {
76  top: parent.top
77  topMargin: 6
78  bottom: parent.bottom
79  left: parent.left
80  leftMargin: 6
81  right: parent.right
82  }
83 
84  Flickable {
85  id: flickable
86  anchors.fill: parent
87  contentHeight: label.paintedHeight
88  flickableDirection: Flickable.VerticalFlick
89  interactive: contentHeight > height
90 
91  Label {
92  id: label
93  anchors {
94  top: parent.top
95  right: parent.right
96  }
97  width: flickable.width
98  height: paintedHeight
99  wrapMode: Text.WordWrap
100  text: root.message
101  horizontalAlignment: lineCount > 1 ? Text.AlignLeft : Text.AlignHCenter
102  }
103  }
104  }
105  }
106 
107  QtObject {
108  id: internal
109 
110  function updateButtonTexts() {
111  var newButtonTexts = []
112  if (acceptButtonText)
113  newButtonTexts.push(acceptButtonText)
114  if (rejectButtonText)
115  newButtonTexts.push(rejectButtonText)
116  root.buttonTexts = newButtonTexts
117  }
118  }
119 }
Label
This is a label which uses the plasma theme.
Definition: Label.qml:32
Item
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

PlasmaComponents

Skip menu "PlasmaComponents"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal