Commit 48101f4f authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

[dialog] Query Dialog 0.1

parent c6116845
/****************************************************************************************
**
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
Page {
id: root
tools: ToolBarLayoutExample { title: "Query dialog example" }
QueryDialog {
cancelText: "Cancel"
acceptText: "Delete"
headingText: "Are you sure you want to delete this?"
onAccepted: {
result.text = "User accepted"
}
onCanceled: {
result.text = "User canceled"
}
}
Label {
id: result
anchors.centerIn: parent
}
}
......@@ -103,6 +103,10 @@ ApplicationWindow {
title: "ButtonRow"
page: "content/ButtonRowPage.qml"
}
ListElement {
title: "Query Dialog"
page: "content/QueryDialogPage.qml"
}
}
......
......@@ -21,5 +21,6 @@
<file>content/LabelPage.qml</file>
<file>content/CheckboxPage.qml</file>
<file>content/ButtonRowPage.qml</file>
<file>content/QueryDialogPage.qml</file>
</qresource>
</RCC>
......@@ -22,7 +22,8 @@ OTHER_FILES += \
content/SpinnerPage.qml \
content/LabelPage.qml \
content/CheckboxPage.qml \
content/ButtonRowPage.qml
content/ButtonRowPage.qml \
content/QueryDialogPage.qml
RESOURCES += \
resources.qrc
......
import QtQuick 2.0
Rectangle {
id: shell
anchors.fill: parent
opacity: 0.7
color: "black"
signal accepted()
signal canceled()
property alias cancelText: cancel.text
property alias acceptText: accept.text
property alias headingText: heading.text
Label {
width: parent.width*0.8
id: heading
anchors.centerIn: parent
wrapMode: Text.Wrap
}
Button {
id: cancel
width: parent.width / 2
anchors {
left: parent.left
bottom: parent.bottom
}
onClicked: {
shell.canceled()
shell.destroy()
}
}
Button {
id: accept
width: parent.width / 2
anchors {
left: cancel.right
bottom: parent.bottom
}
onClicked: {
shell.accepted()
shell.destroy()
}
}
}
......@@ -18,7 +18,8 @@ QML_FILES += \
OTHER_FILES += qmldir \
$$QML_FILES \
ButtonRow.qml
ButtonRow.qml \
QueryDialog.qml
HEADERS += \
qquicknemocontrolsextensionplugin.h \
......
......@@ -15,6 +15,7 @@ Spinner 1.0 Spinner.qml
Label 1.0 Label.qml
CheckBox 1.0 Checkbox.qml
ButtonRow 1.0 ButtonRow.qml
QueryDialog 1.0 QueryDialog.qml
# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
# This is to avoid having to "import QtQuick.Controls" when using controls
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment