init
@@ -0,0 +1,405 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Window 2.1
|
||||
import "qml"
|
||||
|
||||
AbstractColorDialog {
|
||||
id: root
|
||||
property bool __valueSet: true // guard to prevent binding loops
|
||||
function __setControlsFromColor() {
|
||||
__valueSet = false
|
||||
hueSlider.value = root.currentHue
|
||||
saturationSlider.value = root.currentSaturation
|
||||
lightnessSlider.value = root.currentLightness
|
||||
alphaSlider.value = root.currentAlpha
|
||||
crosshairs.x = root.currentLightness * paletteMap.width
|
||||
crosshairs.y = (1.0 - root.currentSaturation) * paletteMap.height
|
||||
__valueSet = true
|
||||
}
|
||||
onCurrentColorChanged: __setControlsFromColor()
|
||||
|
||||
Rectangle {
|
||||
id: content
|
||||
implicitHeight: Math.min(root.__maximumDimension, Screen.pixelDensity * (usePaletteMap ? 120 : 50))
|
||||
implicitWidth: Math.min(root.__maximumDimension, usePaletteMap ? Screen.pixelDensity * (usePaletteMap ? 100 : 50) : implicitHeight * 1.5)
|
||||
color: palette.window
|
||||
focus: root.visible
|
||||
property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3
|
||||
property real spacing: 8
|
||||
property real outerSpacing: 12
|
||||
property bool usePaletteMap: true
|
||||
|
||||
Keys.onPressed: {
|
||||
event.accepted = true
|
||||
switch (event.key) {
|
||||
case Qt.Key_Return:
|
||||
case Qt.Key_Select:
|
||||
accept()
|
||||
break
|
||||
case Qt.Key_Escape:
|
||||
case Qt.Key_Back:
|
||||
reject()
|
||||
break
|
||||
case Qt.Key_C:
|
||||
if (event.modifiers & Qt.ControlModifier)
|
||||
colorField.copyAll()
|
||||
break
|
||||
case Qt.Key_V:
|
||||
if (event.modifiers & Qt.ControlModifier) {
|
||||
colorField.paste()
|
||||
root.currentColor = colorField.text
|
||||
}
|
||||
break
|
||||
default:
|
||||
// do nothing
|
||||
event.accepted = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Item {
|
||||
id: paletteFrame
|
||||
visible: content.usePaletteMap
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: content.outerSpacing
|
||||
}
|
||||
height: Math.min(content.height - content.bottomMinHeight, content.width - content.outerSpacing * 2)
|
||||
|
||||
Image {
|
||||
id: paletteMap
|
||||
x: (parent.width - width) / 2
|
||||
width: height
|
||||
onWidthChanged: root.__setControlsFromColor()
|
||||
height: parent.height
|
||||
source: "images/checkers.png"
|
||||
fillMode: Image.Tile
|
||||
|
||||
// note we smoothscale the shader from a smaller version to improve performance
|
||||
ShaderEffect {
|
||||
id: map
|
||||
width: 64
|
||||
height: 64
|
||||
opacity: alphaSlider.value
|
||||
scale: paletteMap.width / width;
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
anchors.centerIn: parent
|
||||
property real hue: hueSlider.value
|
||||
|
||||
fragmentShader: content.OpenGLInfo.profile === OpenGLInfo.CoreProfile ? "#version 150
|
||||
in vec2 qt_TexCoord0;
|
||||
uniform float qt_Opacity;
|
||||
uniform float hue;
|
||||
out vec4 fragColor;
|
||||
|
||||
float hueToIntensity(float v1, float v2, float h) {
|
||||
h = fract(h);
|
||||
if (h < 1.0 / 6.0)
|
||||
return v1 + (v2 - v1) * 6.0 * h;
|
||||
else if (h < 1.0 / 2.0)
|
||||
return v2;
|
||||
else if (h < 2.0 / 3.0)
|
||||
return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
|
||||
|
||||
return v1;
|
||||
}
|
||||
|
||||
vec3 HSLtoRGB(vec3 color) {
|
||||
float h = color.x;
|
||||
float l = color.z;
|
||||
float s = color.y;
|
||||
|
||||
if (s < 1.0 / 256.0)
|
||||
return vec3(l, l, l);
|
||||
|
||||
float v1;
|
||||
float v2;
|
||||
if (l < 0.5)
|
||||
v2 = l * (1.0 + s);
|
||||
else
|
||||
v2 = (l + s) - (s * l);
|
||||
|
||||
v1 = 2.0 * l - v2;
|
||||
|
||||
float d = 1.0 / 3.0;
|
||||
float r = hueToIntensity(v1, v2, h + d);
|
||||
float g = hueToIntensity(v1, v2, h);
|
||||
float b = hueToIntensity(v1, v2, h - d);
|
||||
return vec3(r, g, b);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 c = vec4(1.0);
|
||||
c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s));
|
||||
fragColor = c * qt_Opacity;
|
||||
}
|
||||
" : "
|
||||
varying mediump vec2 qt_TexCoord0;
|
||||
uniform highp float qt_Opacity;
|
||||
uniform highp float hue;
|
||||
|
||||
highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
|
||||
h = fract(h);
|
||||
if (h < 1.0 / 6.0)
|
||||
return v1 + (v2 - v1) * 6.0 * h;
|
||||
else if (h < 1.0 / 2.0)
|
||||
return v2;
|
||||
else if (h < 2.0 / 3.0)
|
||||
return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
|
||||
|
||||
return v1;
|
||||
}
|
||||
|
||||
highp vec3 HSLtoRGB(highp vec3 color) {
|
||||
highp float h = color.x;
|
||||
highp float l = color.z;
|
||||
highp float s = color.y;
|
||||
|
||||
if (s < 1.0 / 256.0)
|
||||
return vec3(l, l, l);
|
||||
|
||||
highp float v1;
|
||||
highp float v2;
|
||||
if (l < 0.5)
|
||||
v2 = l * (1.0 + s);
|
||||
else
|
||||
v2 = (l + s) - (s * l);
|
||||
|
||||
v1 = 2.0 * l - v2;
|
||||
|
||||
highp float d = 1.0 / 3.0;
|
||||
highp float r = hueToIntensity(v1, v2, h + d);
|
||||
highp float g = hueToIntensity(v1, v2, h);
|
||||
highp float b = hueToIntensity(v1, v2, h - d);
|
||||
return vec3(r, g, b);
|
||||
}
|
||||
|
||||
void main() {
|
||||
lowp vec4 c = vec4(1.0);
|
||||
c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s));
|
||||
gl_FragColor = c * qt_Opacity;
|
||||
}
|
||||
"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mapMouseArea
|
||||
anchors.fill: parent
|
||||
onPositionChanged: {
|
||||
if (pressed && containsMouse) {
|
||||
var xx = Math.max(0, Math.min(mouse.x, parent.width))
|
||||
var yy = Math.max(0, Math.min(mouse.y, parent.height))
|
||||
saturationSlider.value = 1.0 - yy / parent.height
|
||||
lightnessSlider.value = xx / parent.width
|
||||
// TODO if we constrain the movement here, can avoid the containsMouse test
|
||||
crosshairs.x = mouse.x - crosshairs.radius
|
||||
crosshairs.y = mouse.y - crosshairs.radius
|
||||
}
|
||||
}
|
||||
onPressed: positionChanged(mouse)
|
||||
}
|
||||
|
||||
Image {
|
||||
id: crosshairs
|
||||
property int radius: width / 2 // truncated to int
|
||||
source: "images/crosshairs.png"
|
||||
}
|
||||
|
||||
BorderImage {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -1
|
||||
anchors.leftMargin: -2
|
||||
source: "images/sunken_frame.png"
|
||||
border.left: 8
|
||||
border.right: 8
|
||||
border.top: 8
|
||||
border.bottom: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: sliders
|
||||
anchors {
|
||||
top: paletteFrame.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: content.outerSpacing
|
||||
}
|
||||
|
||||
ColorSlider {
|
||||
id: hueSlider
|
||||
value: 0.5
|
||||
onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
|
||||
text: qsTr("Hue")
|
||||
trackDelegate: Rectangle {
|
||||
rotation: -90
|
||||
transformOrigin: Item.TopLeft
|
||||
gradient: Gradient {
|
||||
GradientStop {position: 0.000; color: Qt.rgba(1, 0, 0, 1)}
|
||||
GradientStop {position: 0.167; color: Qt.rgba(1, 1, 0, 1)}
|
||||
GradientStop {position: 0.333; color: Qt.rgba(0, 1, 0, 1)}
|
||||
GradientStop {position: 0.500; color: Qt.rgba(0, 1, 1, 1)}
|
||||
GradientStop {position: 0.667; color: Qt.rgba(0, 0, 1, 1)}
|
||||
GradientStop {position: 0.833; color: Qt.rgba(1, 0, 1, 1)}
|
||||
GradientStop {position: 1.000; color: Qt.rgba(1, 0, 0, 1)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColorSlider {
|
||||
id: saturationSlider
|
||||
visible: !content.usePaletteMap
|
||||
value: 0.5
|
||||
onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
|
||||
text: qsTr("Saturation")
|
||||
trackDelegate: Rectangle {
|
||||
rotation: -90
|
||||
transformOrigin: Item.TopLeft
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0; color: Qt.hsla(hueSlider.value, 0.0, lightnessSlider.value, 1.0) }
|
||||
GradientStop { position: 1; color: Qt.hsla(hueSlider.value, 1.0, lightnessSlider.value, 1.0) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColorSlider {
|
||||
id: lightnessSlider
|
||||
visible: !content.usePaletteMap
|
||||
value: 0.5
|
||||
onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
|
||||
text: qsTr("Luminosity")
|
||||
trackDelegate: Rectangle {
|
||||
rotation: -90
|
||||
transformOrigin: Item.TopLeft
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0; color: "black" }
|
||||
GradientStop { position: 0.5; color: Qt.hsla(hueSlider.value, saturationSlider.value, 0.5, 1.0) }
|
||||
GradientStop { position: 1; color: "white" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColorSlider {
|
||||
id: alphaSlider
|
||||
minimum: 0.0
|
||||
maximum: 1.0
|
||||
value: 1.0
|
||||
onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
|
||||
text: qsTr("Alpha")
|
||||
visible: root.showAlphaChannel
|
||||
trackDelegate: Item {
|
||||
rotation: -90
|
||||
transformOrigin: Item.TopLeft
|
||||
Image {
|
||||
anchors {fill: parent}
|
||||
source: "images/checkers.png"
|
||||
fillMode: Image.TileVertically
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0; color: "transparent" }
|
||||
GradientStop { position: 1; color: Qt.hsla(hueSlider.value,
|
||||
saturationSlider.value,
|
||||
lightnessSlider.value, 1.0) }
|
||||
} }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: buttonRow
|
||||
height: Math.max(buttonsOnly.height, copyIcon.height)
|
||||
width: parent.width
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: content.bottom
|
||||
margins: content.outerSpacing
|
||||
}
|
||||
Row {
|
||||
spacing: content.spacing
|
||||
height: visible ? parent.height : 0
|
||||
visible: !Settings.isMobile
|
||||
TextField {
|
||||
id: colorField
|
||||
text: root.currentColor.toString()
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onAccepted: root.currentColor = text
|
||||
Component.onCompleted: width = implicitWidth + 10
|
||||
}
|
||||
Image {
|
||||
id: copyIcon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
source: "images/copy.png"
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: colorField.copyAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
id: buttonsOnly
|
||||
spacing: content.spacing
|
||||
anchors.right: parent.right
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: qsTr("Cancel")
|
||||
onClicked: root.reject()
|
||||
}
|
||||
Button {
|
||||
id: okButton
|
||||
text: qsTr("OK")
|
||||
onClicked: root.accept()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
import "qml"
|
||||
|
||||
AbstractDialog {
|
||||
id: root
|
||||
default property alias data: defaultContentItem.data
|
||||
|
||||
signal actionChosen(var action)
|
||||
|
||||
onVisibilityChanged: if (visible && contentItem) contentItem.forceActiveFocus()
|
||||
|
||||
Rectangle {
|
||||
id: content
|
||||
property real spacing: 6
|
||||
property real outerSpacing: 12
|
||||
property real buttonsRowImplicitHeight: 0
|
||||
property real buttonsRowImplicitWidth: Screen.pixelDensity * 50
|
||||
property bool buttonsInSingleRow: defaultContentItem.width >= buttonsRowImplicitWidth
|
||||
property real minimumHeight: implicitHeight
|
||||
property real minimumWidth: implicitWidth
|
||||
implicitHeight: defaultContentItem.implicitHeight + spacing + outerSpacing * 2 + Math.max(buttonsRight.implicitHeight, buttonsRowImplicitHeight)
|
||||
implicitWidth: Math.min(root.__maximumDimension, Math.max(
|
||||
defaultContentItem.implicitWidth, buttonsRowImplicitWidth, Screen.pixelDensity * 50) + outerSpacing * 2)
|
||||
color: palette.window
|
||||
Keys.onPressed: {
|
||||
event.accepted = handleKey(event.key)
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Item {
|
||||
id: defaultContentItem
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: buttonsLeft.implicitHeight ? buttonsLeft.top : buttonsRight.top
|
||||
margins: content.outerSpacing
|
||||
bottomMargin: buttonsLeft.implicitHeight + buttonsRight.implicitHeight > 0 ? content.spacing : 0
|
||||
}
|
||||
implicitHeight: children.length === 1 ? children[0].implicitHeight
|
||||
: (children.length ? childrenRect.height : 0)
|
||||
implicitWidth: children.length === 1 ? children[0].implicitWidth
|
||||
: (children.length ? childrenRect.width : 0)
|
||||
}
|
||||
|
||||
Flow {
|
||||
id: buttonsLeft
|
||||
spacing: content.spacing
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: content.buttonsInSingleRow ? parent.bottom : buttonsRight.top
|
||||
margins: content.outerSpacing
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: buttonsLeftRepeater
|
||||
Button {
|
||||
text: (buttonsLeftRepeater.model && buttonsLeftRepeater.model[index] ? buttonsLeftRepeater.model[index].text : index)
|
||||
onClicked: content.handleButton(buttonsLeftRepeater.model[index].standardButton)
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: moreButton
|
||||
text: qsTr("Show Details...")
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
|
||||
Flow {
|
||||
id: buttonsRight
|
||||
spacing: content.spacing
|
||||
layoutDirection: Qt.RightToLeft
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: content.outerSpacing
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: buttonsRightRepeater
|
||||
// TODO maybe: insert gaps if the button requires it (destructive buttons only)
|
||||
Button {
|
||||
text: (buttonsRightRepeater.model && buttonsRightRepeater.model[index] ? buttonsRightRepeater.model[index].text : index)
|
||||
onClicked: content.handleButton(buttonsRightRepeater.model[index].standardButton)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleButton(button) {
|
||||
var action = {
|
||||
"button": button,
|
||||
"key": 0,
|
||||
"accepted": true,
|
||||
}
|
||||
root.actionChosen(action)
|
||||
if (action.accepted) {
|
||||
click(button)
|
||||
}
|
||||
}
|
||||
|
||||
function handleKey(key) {
|
||||
var button = 0
|
||||
switch (key) {
|
||||
case Qt.Key_Escape:
|
||||
case Qt.Key_Back:
|
||||
button = StandardButton.Cancel
|
||||
break
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return:
|
||||
button = StandardButton.Ok
|
||||
break
|
||||
default:
|
||||
return false
|
||||
}
|
||||
var action = {
|
||||
"button": button,
|
||||
"key": key,
|
||||
"accepted": true,
|
||||
}
|
||||
root.actionChosen(action)
|
||||
if (action.accepted) {
|
||||
switch (button) {
|
||||
case StandardButton.Cancel:
|
||||
reject()
|
||||
break
|
||||
case StandardButton.Ok:
|
||||
accept()
|
||||
break
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
function setupButtons() {
|
||||
buttonsLeftRepeater.model = root.__standardButtonsLeftModel()
|
||||
buttonsRightRepeater.model = root.__standardButtonsRightModel()
|
||||
if (buttonsRightRepeater.model && buttonsRightRepeater.model.length > 0)
|
||||
content.buttonsRowImplicitHeight = buttonsRight.visibleChildren[0].implicitHeight
|
||||
if (buttonsLeftRepeater.count + buttonsRightRepeater.count < 1)
|
||||
return;
|
||||
var calcWidth = 0;
|
||||
|
||||
function calculateForButton(i, b) {
|
||||
var buttonWidth = b.implicitWidth;
|
||||
if (buttonWidth > 0) {
|
||||
if (i > 0)
|
||||
buttonWidth += content.spacing
|
||||
calcWidth += buttonWidth
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < buttonsRight.visibleChildren.length; ++i)
|
||||
calculateForButton(i, buttonsRight.visibleChildren[i])
|
||||
content.minimumWidth = Math.max(calcWidth + content.outerSpacing * 2, content.implicitWidth)
|
||||
for (i = 0; i < buttonsLeft.visibleChildren.length; ++i)
|
||||
calculateForButton(i, buttonsLeft.visibleChildren[i])
|
||||
content.buttonsRowImplicitWidth = calcWidth + content.spacing
|
||||
}
|
||||
onStandardButtonsChanged: setupButtons()
|
||||
Component.onCompleted: setupButtons()
|
||||
}
|
||||
@@ -0,0 +1,488 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQml 2.14 as Qml
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0 as ControlsPrivate
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Dialogs.Private 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
import Qt.labs.folderlistmodel 2.1
|
||||
import Qt.labs.settings 1.0
|
||||
import "qml"
|
||||
|
||||
AbstractFileDialog {
|
||||
id: root
|
||||
|
||||
property Component modelComponent: Component {
|
||||
FolderListModel {
|
||||
showFiles: !root.selectFolder
|
||||
nameFilters: root.selectedNameFilterExtensions
|
||||
sortField: (view.sortIndicatorColumn === 0 ? FolderListModel.Name :
|
||||
(view.sortIndicatorColumn === 1 ? FolderListModel.Type :
|
||||
(view.sortIndicatorColumn === 2 ? FolderListModel.Size : FolderListModel.LastModified)))
|
||||
sortReversed: view.sortIndicatorOrder === Qt.DescendingOrder
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
// If the TableView doesn't have a model yet, create it asynchronously to avoid a UI freeze
|
||||
if (!view.model) {
|
||||
var incubator = modelComponent.incubateObject(null, { })
|
||||
function init(model) {
|
||||
view.model = model
|
||||
model.nameFilters = root.selectedNameFilterExtensions
|
||||
root.folder = model.folder
|
||||
}
|
||||
|
||||
if (incubator.status === Component.Ready) {
|
||||
init(incubator.object)
|
||||
} else {
|
||||
incubator.onStatusChanged = function(status) {
|
||||
if (status === Component.Ready)
|
||||
init(incubator.object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.needsWidthAdjustment = true
|
||||
view.selection.clear()
|
||||
view.focus = true
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
filterField.currentIndex = root.selectedNameFilterIndex
|
||||
root.favoriteFolders = settings.favoriteFolders
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
settings.favoriteFolders = root.favoriteFolders
|
||||
}
|
||||
|
||||
property Settings settings: Settings {
|
||||
category: "QQControlsFileDialog"
|
||||
property alias width: root.width
|
||||
property alias height: root.height
|
||||
property alias sidebarWidth: sidebar.width
|
||||
property alias sidebarSplit: shortcutsScroll.height
|
||||
property alias sidebarVisible: root.sidebarVisible
|
||||
property variant favoriteFolders: []
|
||||
}
|
||||
|
||||
property bool showFocusHighlight: false
|
||||
property SystemPalette palette: SystemPalette { }
|
||||
property var favoriteFolders: []
|
||||
|
||||
function dirDown(path) {
|
||||
view.selection.clear()
|
||||
root.folder = root.pathToUrl(path)
|
||||
}
|
||||
function dirUp() {
|
||||
view.selection.clear()
|
||||
if (view.model.parentFolder != "")
|
||||
root.folder = view.model.parentFolder
|
||||
}
|
||||
function acceptSelection() {
|
||||
// transfer the view's selections to QQuickFileDialog
|
||||
clearSelection()
|
||||
if (selectFolder && view.selection.count === 0)
|
||||
addSelection(folder)
|
||||
else {
|
||||
view.selection.forEach(function(idx) {
|
||||
if (view.model.isFolder(idx)) {
|
||||
if (selectFolder)
|
||||
addSelection(view.model.get(idx, "fileURL"))
|
||||
} else {
|
||||
if (!selectFolder)
|
||||
addSelection(view.model.get(idx, "fileURL"))
|
||||
}
|
||||
})
|
||||
}
|
||||
accept()
|
||||
}
|
||||
|
||||
property Action dirUpAction: Action {
|
||||
text: "\ue810"
|
||||
shortcut: "Ctrl+U"
|
||||
onTriggered: dirUp()
|
||||
tooltip: qsTr("Go up to the folder containing this one")
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
implicitWidth: Math.min(root.__maximumDimension, Math.max(Screen.pixelDensity * 100, splitter.implicitWidth))
|
||||
implicitHeight: Math.min(root.__maximumDimension, Screen.pixelDensity * 80)
|
||||
color: root.palette.window
|
||||
|
||||
Qml.Binding {
|
||||
target: view.model
|
||||
property: "folder"
|
||||
value: root.folder
|
||||
restoreMode: Binding.RestoreBinding
|
||||
}
|
||||
Qml.Binding {
|
||||
target: currentPathField
|
||||
property: "text"
|
||||
value: root.urlToPath(root.folder)
|
||||
restoreMode: Binding.RestoreBinding
|
||||
}
|
||||
Keys.onPressed: {
|
||||
event.accepted = true
|
||||
switch (event.key) {
|
||||
case Qt.Key_Back:
|
||||
case Qt.Key_Escape:
|
||||
reject()
|
||||
break
|
||||
default:
|
||||
event.accepted = false
|
||||
break
|
||||
}
|
||||
}
|
||||
Keys.forwardTo: [view.flickableItem]
|
||||
|
||||
SplitView {
|
||||
id: splitter
|
||||
x: 0
|
||||
width: parent.width
|
||||
anchors.top: titleBar.bottom
|
||||
anchors.bottom: bottomBar.top
|
||||
|
||||
Column {
|
||||
id: sidebar
|
||||
Component.onCompleted: if (width < 1) width = sidebarSplitter.maxShortcutWidth
|
||||
height: parent.height
|
||||
width: 0 // initial width only; settings and onCompleted will override it
|
||||
visible: root.sidebarVisible
|
||||
SplitView {
|
||||
id: sidebarSplitter
|
||||
orientation: Qt.Vertical
|
||||
property real rowHeight: 10
|
||||
property real maxShortcutWidth: 80
|
||||
width: parent.width
|
||||
height: parent.height - favoritesButtons.height
|
||||
|
||||
ScrollView {
|
||||
id: shortcutsScroll
|
||||
Component.onCompleted: {
|
||||
if (height < 1)
|
||||
height = sidebarSplitter.rowHeight * 4.65
|
||||
Layout.minimumHeight = sidebarSplitter.rowHeight * 2.65
|
||||
}
|
||||
height: 0 // initial width only; settings and onCompleted will override it
|
||||
ListView {
|
||||
id: shortcutsView
|
||||
model: __shortcuts.length
|
||||
anchors.bottomMargin: ControlsPrivate.Settings.hasTouchScreen ? Screen.pixelDensity * 3.5 : anchors.margins
|
||||
implicitHeight: model.count * sidebarSplitter.rowHeight
|
||||
delegate: Item {
|
||||
id: shortcutItem
|
||||
width: sidebarSplitter.width
|
||||
height: shortcutLabel.implicitHeight * 1.5
|
||||
Text {
|
||||
id: shortcutLabel
|
||||
text: __shortcuts[index].name
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 4
|
||||
}
|
||||
elide: Text.ElideLeft
|
||||
renderType: ControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
Component.onCompleted: {
|
||||
sidebarSplitter.rowHeight = parent.height
|
||||
if (implicitWidth * 1.2 > sidebarSplitter.maxShortcutWidth)
|
||||
sidebarSplitter.maxShortcutWidth = implicitWidth * 1.2
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.folder = __shortcuts[index].url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
Layout.minimumHeight: sidebarSplitter.rowHeight * 2.5
|
||||
ListView {
|
||||
id: favorites
|
||||
model: root.favoriteFolders
|
||||
anchors.topMargin: ControlsPrivate.Settings.hasTouchScreen ? Screen.pixelDensity * 3.5 : anchors.margins
|
||||
delegate: Item {
|
||||
width: favorites.width
|
||||
height: folderLabel.implicitHeight * 1.5
|
||||
Text {
|
||||
id: folderLabel
|
||||
text: root.favoriteFolders[index]
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 4
|
||||
}
|
||||
elide: Text.ElideLeft
|
||||
renderType: ControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
Menu {
|
||||
id: favoriteCtxMenu
|
||||
title: root.favoriteFolders[index]
|
||||
MenuItem {
|
||||
text: qsTr("Remove favorite")
|
||||
onTriggered: {
|
||||
root.favoriteFolders.splice(index, 1)
|
||||
favorites.model = root.favoriteFolders
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: favoriteArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.LeftButton)
|
||||
root.folder = root.favoriteFolders[index]
|
||||
else if (mouse.button == Qt.RightButton)
|
||||
favoriteCtxMenu.popup()
|
||||
}
|
||||
onExited: ControlsPrivate.Tooltip.hideText()
|
||||
onCanceled: ControlsPrivate.Tooltip.hideText()
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: favoriteArea.containsMouse && !favoriteArea.pressed && folderLabel.truncated
|
||||
onTriggered: ControlsPrivate.Tooltip.showText(favoriteArea,
|
||||
Qt.point(favoriteArea.mouseX, favoriteArea.mouseY), urlToPath(root.favoriteFolders[index]))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: favoritesButtons
|
||||
height: plusButton.height + 1
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 6
|
||||
layoutDirection: Qt.RightToLeft
|
||||
Button {
|
||||
id: plusButton
|
||||
style: IconButtonStyle { }
|
||||
text: "\ue83e"
|
||||
tooltip: qsTr("Add the current directory as a favorite")
|
||||
width: height
|
||||
onClicked: {
|
||||
root.favoriteFolders.push(root.folder)
|
||||
favorites.model = root.favoriteFolders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: view
|
||||
sortIndicatorVisible: true
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 40
|
||||
property bool needsWidthAdjustment: true
|
||||
selectionMode: root.selectMultiple ?
|
||||
(ControlsPrivate.Settings.hasTouchScreen ? SelectionMode.MultiSelection : SelectionMode.ExtendedSelection) :
|
||||
SelectionMode.SingleSelection
|
||||
onRowCountChanged: if (needsWidthAdjustment && rowCount > 0) {
|
||||
resizeColumnsToContents()
|
||||
needsWidthAdjustment = false
|
||||
}
|
||||
model: null
|
||||
|
||||
onActivated: if (view.focus) {
|
||||
if (view.selection.count > 0 && view.model.isFolder(row)) {
|
||||
dirDown(view.model.get(row, "filePath"))
|
||||
} else {
|
||||
root.acceptSelection()
|
||||
}
|
||||
}
|
||||
onClicked: currentPathField.text = view.model.get(row, "filePath")
|
||||
|
||||
|
||||
TableViewColumn {
|
||||
id: fileNameColumn
|
||||
role: "fileName"
|
||||
title: qsTr("Filename")
|
||||
delegate: Item {
|
||||
implicitWidth: pathText.implicitWidth + pathText.anchors.leftMargin + pathText.anchors.rightMargin
|
||||
IconGlyph {
|
||||
id: fileIcon
|
||||
x: 4
|
||||
height: parent.height - 2
|
||||
unicode: view.model.isFolder(styleData.row) ? "\ue804" : "\ue802"
|
||||
}
|
||||
Text {
|
||||
id: pathText
|
||||
text: styleData.value
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: fileIcon.width + 6
|
||||
rightMargin: 4
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color: styleData.textColor
|
||||
elide: Text.ElideRight
|
||||
renderType: ControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
}
|
||||
}
|
||||
TableViewColumn {
|
||||
role: "fileSuffix"
|
||||
title: qsTr("Type", "file type (extension)")
|
||||
// TODO should not need to create a whole new component just to customize the text value
|
||||
// something like textFormat: function(text) { return view.model.get(styleData.row, "fileIsDir") ? "folder" : text }
|
||||
delegate: Item {
|
||||
implicitWidth: sizeText.implicitWidth + sizeText.anchors.leftMargin + sizeText.anchors.rightMargin
|
||||
Text {
|
||||
id: sizeText
|
||||
text: view.model.get(styleData.row, "fileIsDir") ? "folder" : styleData.value
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 4
|
||||
rightMargin: 4
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color: styleData.textColor
|
||||
elide: Text.ElideRight
|
||||
renderType: ControlsPrivate.Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
}
|
||||
}
|
||||
TableViewColumn {
|
||||
role: "fileSize"
|
||||
title: qsTr("Size", "file size")
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
TableViewColumn { id: modifiedColumn; role: "fileModified" ; title: qsTr("Modified", "last-modified time") }
|
||||
TableViewColumn { id: accessedColumn; role: "fileAccessed" ; title: qsTr("Accessed", "last-accessed time") }
|
||||
}
|
||||
}
|
||||
|
||||
ToolBar {
|
||||
id: titleBar
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
ToolButton {
|
||||
action: dirUpAction
|
||||
style: IconButtonStyle { }
|
||||
Layout.maximumWidth: height * 1.5
|
||||
}
|
||||
TextField {
|
||||
id: currentPathField
|
||||
Layout.fillWidth: true
|
||||
function doAccept() {
|
||||
root.clearSelection()
|
||||
if (root.addSelection(root.pathToUrl(text)))
|
||||
root.accept()
|
||||
else
|
||||
root.folder = root.pathFolder(text)
|
||||
}
|
||||
onAccepted: doAccept()
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: bottomBar
|
||||
width: parent.width
|
||||
height: buttonRow.height + buttonRow.spacing * 2
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: spacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: 4
|
||||
Button {
|
||||
id: toggleSidebarButton
|
||||
checkable: true
|
||||
style: IconButtonStyle { }
|
||||
text: "\u25E7"
|
||||
height: cancelButton.height
|
||||
width: height
|
||||
checked: root.sidebarVisible
|
||||
onClicked: {
|
||||
root.sidebarVisible = !root.sidebarVisible
|
||||
}
|
||||
}
|
||||
ComboBox {
|
||||
id: filterField
|
||||
model: root.nameFilters
|
||||
visible: !selectFolder
|
||||
width: bottomBar.width - toggleSidebarButton.width - cancelButton.width - okButton.width - parent.spacing * 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onCurrentTextChanged: {
|
||||
root.selectNameFilter(currentText)
|
||||
if (view.model)
|
||||
view.model.nameFilters = root.selectedNameFilterExtensions
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: qsTr("Cancel")
|
||||
onClicked: root.reject()
|
||||
}
|
||||
Button {
|
||||
id: okButton
|
||||
text: root.selectFolder ? qsTr("Choose") : (selectExisting ? qsTr("Open") : qsTr("Save"))
|
||||
onClicked: {
|
||||
if (view.model.isFolder(view.currentRow) && !selectFolder)
|
||||
dirDown(view.model.get(view.currentRow, "filePath"))
|
||||
else if (!(root.selectExisting))
|
||||
currentPathField.doAccept()
|
||||
else
|
||||
root.acceptSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Controls.Styles 1.0
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Dialogs.Private 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
import "qml"
|
||||
|
||||
AbstractFontDialog {
|
||||
id: root
|
||||
|
||||
property alias font: content.externalFont
|
||||
property alias currentFont: content.font
|
||||
property bool isAndroid: Qt.platform.os === "android"
|
||||
|
||||
Screen.onPrimaryOrientationChanged: {
|
||||
if (isAndroid)
|
||||
setWidthsToMatchAndroid()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (isAndroid)
|
||||
setWidthsToMatchAndroid()
|
||||
}
|
||||
|
||||
function setWidthsToMatchAndroid() {
|
||||
fontListView.Layout.maximumWidth = content.width - weightListView.width - pointSizeSpinBox.width - content.outerSpacing
|
||||
wsComboBox.Layout.maximumWidth = (content.width / 2) - content.outerSpacing
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: content
|
||||
SystemPalette { id: palette }
|
||||
|
||||
implicitWidth: root.isAndroid ? Math.min(Screen.width, Screen.height) * (9 / 10) : Math.min(root.__maximumDimension, Screen.pixelDensity * 100)
|
||||
implicitHeight: (Screen.primaryOrientation === Qt.PortraitOrientation || Screen.primaryOrientation === Qt.InvertedPortraitOrientation)
|
||||
? Math.max(root.__maximumDimension, Screen.pixelDensity * 60)
|
||||
: Math.min(root.__maximumDimension, Screen.pixelDensity * 60)
|
||||
property real spacing: 6
|
||||
property real outerSpacing: 12
|
||||
color: palette.window
|
||||
|
||||
property font font: Qt.font({ family: "Helvetica", pointSize: 24, weight: Font.Normal })
|
||||
property font externalFont
|
||||
property string writingSystem
|
||||
property string writingSystemSample
|
||||
property var pointSizes
|
||||
|
||||
onExternalFontChanged: {
|
||||
if (Component.status != Component.Ready)
|
||||
return
|
||||
|
||||
if (content.font != content.externalFont) {
|
||||
font = externalFont
|
||||
wsComboBox.reset()
|
||||
fontListView.reset()
|
||||
weightListView.reset()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: externalFontChanged()
|
||||
|
||||
onWritingSystemSampleChanged: { sample.text = writingSystemSample; }
|
||||
|
||||
Keys.onPressed: {
|
||||
event.accepted = true
|
||||
switch (event.key) {
|
||||
case Qt.Key_Return:
|
||||
case Qt.Key_Select:
|
||||
updateUponAccepted()
|
||||
break
|
||||
case Qt.Key_Escape:
|
||||
case Qt.Key_Back:
|
||||
reject()
|
||||
break
|
||||
default:
|
||||
// do nothing
|
||||
event.accepted = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
function updateUponAccepted() {
|
||||
root.font = content.font
|
||||
root.accept()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
anchors { fill: parent; margins: content.outerSpacing }
|
||||
spacing: content.spacing
|
||||
|
||||
GridLayout {
|
||||
columnSpacing: content.spacing; rowSpacing: content.spacing
|
||||
columns: 3
|
||||
|
||||
Label { id: fontNameLabel; horizontalAlignment: Text.AlignLeft; Layout.fillWidth: true; text: qsTr("Font"); font.bold: true }
|
||||
Label { id: weightLabel; horizontalAlignment: Text.AlignLeft; text: qsTr("Weight"); font.bold: true }
|
||||
Label { id: sizeLabel; horizontalAlignment: Text.AlignLeft; text: qsTr("Size"); font.bold: true }
|
||||
TableView {
|
||||
id: fontListView
|
||||
focus: true
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: fontColumn.width
|
||||
headerVisible: false
|
||||
function reset() {
|
||||
fontModel.findIndex()
|
||||
content.pointSizes = fontModel.pointSizes()
|
||||
fontModel.findPointSizesIndex()
|
||||
}
|
||||
TableViewColumn{ id: fontColumn; role: "family"; title: qsTr("Font Family") }
|
||||
itemDelegate: Text {
|
||||
width: parent.width
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
}
|
||||
model: FontListModel {
|
||||
id: fontModel
|
||||
scalableFonts: root.scalableFonts
|
||||
nonScalableFonts: root.nonScalableFonts
|
||||
monospacedFonts: root.monospacedFonts
|
||||
proportionalFonts: root.proportionalFonts
|
||||
Component.onCompleted: fontListView.reset()
|
||||
onModelReset: { findIndex(); }
|
||||
function findIndex() {
|
||||
fontListView.selection.clear()
|
||||
if (fontModel.count <= 0 || fontListView.rowCount <= 0)
|
||||
return
|
||||
|
||||
var currentRow = 0
|
||||
if (content.font.family != "") {
|
||||
for (var i = 0; i < fontModel.count; ++i) {
|
||||
if (content.font.family == fontModel.get(i).family) {
|
||||
currentRow = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
content.font.family = fontModel.get(currentRow).family
|
||||
fontListView.selection.select(currentRow)
|
||||
fontListView.positionViewAtRow(currentRow, ListView.Contain)
|
||||
fontListView.clicked(currentRow)
|
||||
}
|
||||
function findPointSizesIndex() {
|
||||
pointSizesListView.selection.clear()
|
||||
if (content.pointSizes.length <= 0 || pointSizesListView.rowCount <= 0)
|
||||
return
|
||||
|
||||
var currentRow = -1
|
||||
for (var i = 0; i < content.pointSizes.length; ++i) {
|
||||
if (content.font.pointSize == content.pointSizes[i]) {
|
||||
currentRow = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (currentRow != -1) {
|
||||
content.font.pointSize = content.pointSizes[currentRow]
|
||||
pointSizesListView.selection.select(currentRow)
|
||||
pointSizesListView.positionViewAtRow(currentRow, ListView.Contain)
|
||||
pointSizesListView.clicked(currentRow)
|
||||
}
|
||||
}
|
||||
}
|
||||
function select(row) {
|
||||
if (row == -1)
|
||||
return
|
||||
currentRow = row
|
||||
content.font.family = fontModel.get(row).family
|
||||
positionViewAtRow(row, ListView.Contain)
|
||||
}
|
||||
onClicked: select(row)
|
||||
onCurrentRowChanged: select(currentRow)
|
||||
}
|
||||
TableView {
|
||||
id: weightListView
|
||||
implicitWidth: (Component.status == Component.Ready) ? (weightColumn.width + content.outerSpacing) : (root.isAndroid ? 180 : 100)
|
||||
Layout.fillHeight: true
|
||||
Component.onCompleted: resizeColumnsToContents();
|
||||
headerVisible: false
|
||||
function reset() {
|
||||
weightModel.findIndex()
|
||||
}
|
||||
TableViewColumn { id: weightColumn; role: "name"; title: qsTr("Weight") }
|
||||
itemDelegate: Text {
|
||||
width: parent.width
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
}
|
||||
model: ListModel {
|
||||
id: weightModel
|
||||
ListElement { name: qsTr("Thin"); weight: Font.Thin }
|
||||
ListElement { name: qsTr("ExtraLight"); weight: Font.ExtraLight }
|
||||
ListElement { name: qsTr("Light"); weight: Font.Light }
|
||||
ListElement { name: qsTr("Normal"); weight: Font.Normal }
|
||||
ListElement { name: qsTr("Medium"); weight: Font.Medium }
|
||||
ListElement { name: qsTr("DemiBold"); weight: Font.DemiBold }
|
||||
ListElement { name: qsTr("Bold"); weight: Font.Bold }
|
||||
ListElement { name: qsTr("ExtraBold"); weight: Font.ExtraBold }
|
||||
ListElement { name: qsTr("Black"); weight: Font.Black }
|
||||
Component.onCompleted: weightListView.reset()
|
||||
function findIndex() {
|
||||
var currentRow = 1
|
||||
for (var i = 0; i < weightModel.count; ++i) {
|
||||
if (content.font.weight == weightModel.get(i).weight) {
|
||||
currentRow = i
|
||||
break
|
||||
}
|
||||
}
|
||||
content.font.weight = weightModel.get(currentRow).family
|
||||
weightListView.selection.select(currentRow)
|
||||
weightListView.positionViewAtRow(currentRow, ListView.Contain)
|
||||
weightListView.clicked(currentRow)
|
||||
}
|
||||
}
|
||||
function select(row) {
|
||||
if (row == -1)
|
||||
return
|
||||
currentRow = row
|
||||
content.font.weight = weightModel.get(row).weight
|
||||
positionViewAtRow(row, ListView.Contain)
|
||||
}
|
||||
onClicked: select(row)
|
||||
onCurrentRowChanged: select(currentRow)
|
||||
}
|
||||
ColumnLayout {
|
||||
SpinBox {
|
||||
id: pointSizeSpinBox;
|
||||
implicitWidth: (Component.status == Component.Ready) ? (psColumn.width + content.outerSpacing) : (root.isAndroid ? 130 : 80)
|
||||
value: content.font.pointSize
|
||||
decimals: 0
|
||||
minimumValue: 1
|
||||
maximumValue: 512
|
||||
onValueChanged: {
|
||||
content.font.pointSize = Number(value);
|
||||
updatePointSizesIndex();
|
||||
}
|
||||
function updatePointSizesIndex() {
|
||||
pointSizesListView.selection.clear()
|
||||
if (content.pointSizes.length <= 0 || pointSizesListView.rowCount <= 0)
|
||||
return
|
||||
var currentRow = -1
|
||||
for (var i = 0; i < content.pointSizes.length; ++i) {
|
||||
if (content.font.pointSize == content.pointSizes[i]) {
|
||||
currentRow = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (currentRow < 0)
|
||||
return
|
||||
content.font.pointSize = content.pointSizes[currentRow]
|
||||
pointSizesListView.selection.select(currentRow)
|
||||
pointSizesListView.positionViewAtRow(currentRow, ListView.Contain)
|
||||
pointSizesListView.clicked(currentRow)
|
||||
}
|
||||
}
|
||||
TableView {
|
||||
id: pointSizesListView
|
||||
Layout.fillHeight: true
|
||||
headerVisible: false
|
||||
implicitWidth: (Component.status == Component.Ready) ? (psColumn.width + content.outerSpacing) : (root.isAndroid ? 130 : 80)
|
||||
Component.onCompleted: resizeColumnsToContents();
|
||||
TableViewColumn{ id: psColumn; role: ""; title: qsTr("Size") }
|
||||
itemDelegate: Text {
|
||||
width: parent.width
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
}
|
||||
model: content.pointSizes
|
||||
property bool guard: false
|
||||
function select(row) {
|
||||
if (row == -1 || !guard)
|
||||
return
|
||||
currentRow = row
|
||||
content.font.pointSize = content.pointSizes[row]
|
||||
pointSizeSpinBox.value = content.pointSizes[row]
|
||||
positionViewAtRow(row, ListView.Contain)
|
||||
}
|
||||
onClicked: select(row)
|
||||
onCurrentRowChanged: {
|
||||
select(currentRow)
|
||||
if (!guard)
|
||||
guard = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: content.spacing
|
||||
Layout.fillHeight: false
|
||||
ColumnLayout {
|
||||
spacing: content.spacing
|
||||
Layout.rowSpan: 3
|
||||
Label { text: qsTr("Style"); font.bold: true }
|
||||
CheckBox {
|
||||
id: italicCheckBox
|
||||
text: qsTr("Italic")
|
||||
checked: content.font.italic
|
||||
onClicked: { content.font.italic = italicCheckBox.checked }
|
||||
}
|
||||
CheckBox {
|
||||
id: underlineCheckBox
|
||||
text: qsTr("Underline")
|
||||
checked: content.font.underline
|
||||
onClicked: { content.font.underline = underlineCheckBox.checked }
|
||||
}
|
||||
CheckBox {
|
||||
id: overlineCheckBox
|
||||
text: qsTr("Overline")
|
||||
checked: content.font.overline
|
||||
onClicked: { content.font.overline = overlineCheckBox.checked }
|
||||
}
|
||||
CheckBox {
|
||||
id: strikeoutCheckBox
|
||||
text: qsTr("Strikeout")
|
||||
checked: content.font.strikeout
|
||||
onClicked: { content.font.strikeout = strikeoutCheckBox.checked }
|
||||
}
|
||||
Item { Layout.fillHeight: true; } //spacer
|
||||
Label { text: qsTr("Writing System"); font.bold: true }
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.rowSpan: 3
|
||||
spacing: content.spacing
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Label { id: sampleLabel; text: qsTr("Sample"); font.bold: true }
|
||||
|
||||
Rectangle {
|
||||
clip: true
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
implicitWidth: Math.min(360, sample.implicitWidth + parent.spacing)
|
||||
implicitHeight: Math.min(240, sample.implicitHeight + parent.spacing)
|
||||
color: "white"
|
||||
border.color: "#999"
|
||||
TextInput {
|
||||
id: sample
|
||||
activeFocusOnTab: true
|
||||
Accessible.name: text
|
||||
Accessible.role: Accessible.EditableText
|
||||
anchors.centerIn: parent
|
||||
font: content.font
|
||||
onFocusChanged: if (!focus && sample.text == "") sample.text = content.writingSystemSample
|
||||
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: buttonRow
|
||||
Layout.columnSpan: 3
|
||||
spacing: content.spacing
|
||||
ComboBox {
|
||||
id: wsComboBox
|
||||
function reset() {
|
||||
if (wsModel.count > 0) {
|
||||
currentIndex = 0
|
||||
}
|
||||
}
|
||||
textRole: "name"
|
||||
model: WritingSystemListModel {
|
||||
id: wsModel
|
||||
Component.onCompleted: wsComboBox.reset()
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
if (currentIndex == -1)
|
||||
return
|
||||
|
||||
content.writingSystem = wsModel.get(currentIndex).name
|
||||
fontModel.writingSystem = content.writingSystem
|
||||
content.writingSystemSample = wsModel.get(currentIndex).sample
|
||||
fontListView.reset()
|
||||
}
|
||||
}
|
||||
Item { Layout.fillWidth: true; } //spacer
|
||||
Button {
|
||||
text: qsTr("Cancel")
|
||||
onClicked: root.reject()
|
||||
}
|
||||
Button {
|
||||
text: qsTr("OK")
|
||||
onClicked: {
|
||||
content.updateUponAccepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Dialogs 1.1
|
||||
import QtQuick.Window 2.1
|
||||
import "qml"
|
||||
|
||||
AbstractMessageDialog {
|
||||
id: root
|
||||
|
||||
Rectangle {
|
||||
id: content
|
||||
property real spacing: 6
|
||||
property real outerSpacing: 12
|
||||
property real buttonsRowImplicitWidth: Screen.pixelDensity * 50
|
||||
implicitHeight: contentColumn.implicitHeight + outerSpacing * 2
|
||||
onImplicitHeightChanged: root.height = implicitHeight
|
||||
implicitWidth: Math.min(root.__maximumDimension, Math.max(
|
||||
mainText.implicitWidth, buttonsRowImplicitWidth) + outerSpacing * 2);
|
||||
onImplicitWidthChanged: root.width = implicitWidth
|
||||
color: palette.window
|
||||
focus: root.visible
|
||||
Keys.onPressed: {
|
||||
event.accepted = true
|
||||
if (event.modifiers === Qt.ControlModifier)
|
||||
switch (event.key) {
|
||||
case Qt.Key_A:
|
||||
detailedText.selectAll()
|
||||
break
|
||||
case Qt.Key_C:
|
||||
detailedText.copy()
|
||||
break
|
||||
case Qt.Key_Period:
|
||||
if (Qt.platform.os === "osx")
|
||||
reject()
|
||||
break
|
||||
} else switch (event.key) {
|
||||
case Qt.Key_Escape:
|
||||
case Qt.Key_Back:
|
||||
reject()
|
||||
break
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return:
|
||||
accept()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: contentColumn
|
||||
spacing: content.spacing
|
||||
x: content.outerSpacing
|
||||
y: content.outerSpacing
|
||||
width: content.width - content.outerSpacing * 2
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(icon.height, mainText.height + informativeText.height + content.spacing)
|
||||
Image {
|
||||
id: icon
|
||||
source: root.standardIconSource
|
||||
}
|
||||
|
||||
Text {
|
||||
id: mainText
|
||||
anchors {
|
||||
left: icon.right
|
||||
leftMargin: content.spacing
|
||||
right: parent.right
|
||||
}
|
||||
text: root.text
|
||||
font.weight: Font.Bold
|
||||
wrapMode: Text.WordWrap
|
||||
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
|
||||
Text {
|
||||
id: informativeText
|
||||
anchors {
|
||||
left: icon.right
|
||||
right: parent.right
|
||||
top: mainText.bottom
|
||||
leftMargin: content.spacing
|
||||
topMargin: content.spacing
|
||||
}
|
||||
text: root.informativeText
|
||||
wrapMode: Text.WordWrap
|
||||
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Flow {
|
||||
id: buttons
|
||||
spacing: content.spacing
|
||||
layoutDirection: Qt.RightToLeft
|
||||
width: parent.width + content.outerSpacing
|
||||
x: -content.outerSpacing
|
||||
Button {
|
||||
id: okButton
|
||||
text: qsTr("OK")
|
||||
onClicked: root.click(StandardButton.Ok)
|
||||
visible: root.standardButtons & StandardButton.Ok
|
||||
}
|
||||
Button {
|
||||
id: openButton
|
||||
text: qsTr("Open")
|
||||
onClicked: root.click(StandardButton.Open)
|
||||
visible: root.standardButtons & StandardButton.Open
|
||||
}
|
||||
Button {
|
||||
id: saveButton
|
||||
text: qsTr("Save")
|
||||
onClicked: root.click(StandardButton.Save)
|
||||
visible: root.standardButtons & StandardButton.Save
|
||||
}
|
||||
Button {
|
||||
id: saveAllButton
|
||||
text: qsTr("Save All")
|
||||
onClicked: root.click(StandardButton.SaveAll)
|
||||
visible: root.standardButtons & StandardButton.SaveAll
|
||||
}
|
||||
Button {
|
||||
id: retryButton
|
||||
text: qsTr("Retry")
|
||||
onClicked: root.click(StandardButton.Retry)
|
||||
visible: root.standardButtons & StandardButton.Retry
|
||||
}
|
||||
Button {
|
||||
id: ignoreButton
|
||||
text: qsTr("Ignore")
|
||||
onClicked: root.click(StandardButton.Ignore)
|
||||
visible: root.standardButtons & StandardButton.Ignore
|
||||
}
|
||||
Button {
|
||||
id: applyButton
|
||||
text: qsTr("Apply")
|
||||
onClicked: root.click(StandardButton.Apply)
|
||||
visible: root.standardButtons & StandardButton.Apply
|
||||
}
|
||||
Button {
|
||||
id: yesButton
|
||||
text: qsTr("Yes")
|
||||
onClicked: root.click(StandardButton.Yes)
|
||||
visible: root.standardButtons & StandardButton.Yes
|
||||
}
|
||||
Button {
|
||||
id: yesAllButton
|
||||
text: qsTr("Yes to All")
|
||||
onClicked: root.click(StandardButton.YesToAll)
|
||||
visible: root.standardButtons & StandardButton.YesToAll
|
||||
}
|
||||
Button {
|
||||
id: noButton
|
||||
text: qsTr("No")
|
||||
onClicked: root.click(StandardButton.No)
|
||||
visible: root.standardButtons & StandardButton.No
|
||||
}
|
||||
Button {
|
||||
id: noAllButton
|
||||
text: qsTr("No to All")
|
||||
onClicked: root.click(StandardButton.NoToAll)
|
||||
visible: root.standardButtons & StandardButton.NoToAll
|
||||
}
|
||||
Button {
|
||||
id: discardButton
|
||||
text: qsTr("Discard")
|
||||
onClicked: root.click(StandardButton.Discard)
|
||||
visible: root.standardButtons & StandardButton.Discard
|
||||
}
|
||||
Button {
|
||||
id: resetButton
|
||||
text: qsTr("Reset")
|
||||
onClicked: root.click(StandardButton.Reset)
|
||||
visible: root.standardButtons & StandardButton.Reset
|
||||
}
|
||||
Button {
|
||||
id: restoreDefaultsButton
|
||||
text: qsTr("Restore Defaults")
|
||||
onClicked: root.click(StandardButton.RestoreDefaults)
|
||||
visible: root.standardButtons & StandardButton.RestoreDefaults
|
||||
}
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: qsTr("Cancel")
|
||||
onClicked: root.click(StandardButton.Cancel)
|
||||
visible: root.standardButtons & StandardButton.Cancel
|
||||
}
|
||||
Button {
|
||||
id: abortButton
|
||||
text: qsTr("Abort")
|
||||
onClicked: root.click(StandardButton.Abort)
|
||||
visible: root.standardButtons & StandardButton.Abort
|
||||
}
|
||||
Button {
|
||||
id: closeButton
|
||||
text: qsTr("Close")
|
||||
onClicked: root.click(StandardButton.Close)
|
||||
visible: root.standardButtons & StandardButton.Close
|
||||
}
|
||||
Button {
|
||||
id: moreButton
|
||||
text: qsTr("Show Details...")
|
||||
onClicked: content.state = (content.state === "" ? "expanded" : "")
|
||||
visible: root.detailedText.length > 0
|
||||
}
|
||||
Button {
|
||||
id: helpButton
|
||||
text: qsTr("Help")
|
||||
onClicked: root.click(StandardButton.Help)
|
||||
visible: root.standardButtons & StandardButton.Help
|
||||
}
|
||||
onVisibleChildrenChanged: calculateImplicitWidth()
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: details
|
||||
width: parent.width
|
||||
implicitHeight: detailedText.implicitHeight + content.spacing
|
||||
height: 0
|
||||
clip: true
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: contentColumn.bottom
|
||||
topMargin: content.spacing
|
||||
leftMargin: content.outerSpacing
|
||||
rightMargin: content.outerSpacing
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
contentHeight: detailedText.height
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: content.spacing
|
||||
anchors.bottomMargin: content.outerSpacing
|
||||
TextEdit {
|
||||
id: detailedText
|
||||
text: root.detailedText
|
||||
width: details.width
|
||||
wrapMode: Text.WordWrap
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "expanded"
|
||||
PropertyChanges {
|
||||
target: details
|
||||
height: content.height - contentColumn.height - content.spacing - content.outerSpacing
|
||||
}
|
||||
PropertyChanges {
|
||||
target: content
|
||||
implicitHeight: contentColumn.implicitHeight + content.spacing * 2 +
|
||||
detailedText.implicitHeight + content.outerSpacing * 2
|
||||
}
|
||||
PropertyChanges {
|
||||
target: moreButton
|
||||
text: qsTr("Hide Details")
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
function calculateImplicitWidth() {
|
||||
if (buttons.visibleChildren.length < 2)
|
||||
return;
|
||||
var calcWidth = 0;
|
||||
for (var i = 0; i < buttons.visibleChildren.length; ++i)
|
||||
calcWidth += Math.max(100, buttons.visibleChildren[i].implicitWidth) + content.spacing
|
||||
content.buttonsRowImplicitWidth = content.outerSpacing + calcWidth
|
||||
}
|
||||
Component.onCompleted: calculateImplicitWidth()
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
import QtQuick.tooling 1.2
|
||||
|
||||
// This file describes the plugin-supplied types contained in the library.
|
||||
// It is used for QML tooling purposes only.
|
||||
//
|
||||
// This file was auto-generated by:
|
||||
// 'qmlplugindump -nonrelocatable QtQuick.Dialogs.Private 1.1'
|
||||
|
||||
Module {
|
||||
dependencies: ["QtQuick 2.0"]
|
||||
Component {
|
||||
name: "QAbstractItemModel"
|
||||
prototype: "QObject"
|
||||
Enum {
|
||||
name: "LayoutChangeHint"
|
||||
values: {
|
||||
"NoLayoutChangeHint": 0,
|
||||
"VerticalSortHint": 1,
|
||||
"HorizontalSortHint": 2
|
||||
}
|
||||
}
|
||||
Enum {
|
||||
name: "CheckIndexOption"
|
||||
values: {
|
||||
"NoOption": 0,
|
||||
"IndexIsValid": 1,
|
||||
"DoNotUseParent": 2,
|
||||
"ParentIsInvalid": 4
|
||||
}
|
||||
}
|
||||
Signal {
|
||||
name: "dataChanged"
|
||||
Parameter { name: "topLeft"; type: "QModelIndex" }
|
||||
Parameter { name: "bottomRight"; type: "QModelIndex" }
|
||||
Parameter { name: "roles"; type: "QVector<int>" }
|
||||
}
|
||||
Signal {
|
||||
name: "dataChanged"
|
||||
Parameter { name: "topLeft"; type: "QModelIndex" }
|
||||
Parameter { name: "bottomRight"; type: "QModelIndex" }
|
||||
}
|
||||
Signal {
|
||||
name: "headerDataChanged"
|
||||
Parameter { name: "orientation"; type: "Qt::Orientation" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "layoutChanged"
|
||||
Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
|
||||
Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
|
||||
}
|
||||
Signal {
|
||||
name: "layoutChanged"
|
||||
Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
|
||||
}
|
||||
Signal { name: "layoutChanged" }
|
||||
Signal {
|
||||
name: "layoutAboutToBeChanged"
|
||||
Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
|
||||
Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
|
||||
}
|
||||
Signal {
|
||||
name: "layoutAboutToBeChanged"
|
||||
Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
|
||||
}
|
||||
Signal { name: "layoutAboutToBeChanged" }
|
||||
Signal {
|
||||
name: "rowsAboutToBeInserted"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "rowsInserted"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "rowsAboutToBeRemoved"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "rowsRemoved"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "columnsAboutToBeInserted"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "columnsInserted"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "columnsAboutToBeRemoved"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "columnsRemoved"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "first"; type: "int" }
|
||||
Parameter { name: "last"; type: "int" }
|
||||
}
|
||||
Signal { name: "modelAboutToBeReset" }
|
||||
Signal { name: "modelReset" }
|
||||
Signal {
|
||||
name: "rowsAboutToBeMoved"
|
||||
Parameter { name: "sourceParent"; type: "QModelIndex" }
|
||||
Parameter { name: "sourceStart"; type: "int" }
|
||||
Parameter { name: "sourceEnd"; type: "int" }
|
||||
Parameter { name: "destinationParent"; type: "QModelIndex" }
|
||||
Parameter { name: "destinationRow"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "rowsMoved"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "start"; type: "int" }
|
||||
Parameter { name: "end"; type: "int" }
|
||||
Parameter { name: "destination"; type: "QModelIndex" }
|
||||
Parameter { name: "row"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "columnsAboutToBeMoved"
|
||||
Parameter { name: "sourceParent"; type: "QModelIndex" }
|
||||
Parameter { name: "sourceStart"; type: "int" }
|
||||
Parameter { name: "sourceEnd"; type: "int" }
|
||||
Parameter { name: "destinationParent"; type: "QModelIndex" }
|
||||
Parameter { name: "destinationColumn"; type: "int" }
|
||||
}
|
||||
Signal {
|
||||
name: "columnsMoved"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
Parameter { name: "start"; type: "int" }
|
||||
Parameter { name: "end"; type: "int" }
|
||||
Parameter { name: "destination"; type: "QModelIndex" }
|
||||
Parameter { name: "column"; type: "int" }
|
||||
}
|
||||
Method { name: "submit"; type: "bool" }
|
||||
Method { name: "revert" }
|
||||
Method {
|
||||
name: "hasIndex"
|
||||
type: "bool"
|
||||
Parameter { name: "row"; type: "int" }
|
||||
Parameter { name: "column"; type: "int" }
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "hasIndex"
|
||||
type: "bool"
|
||||
Parameter { name: "row"; type: "int" }
|
||||
Parameter { name: "column"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "index"
|
||||
type: "QModelIndex"
|
||||
Parameter { name: "row"; type: "int" }
|
||||
Parameter { name: "column"; type: "int" }
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "index"
|
||||
type: "QModelIndex"
|
||||
Parameter { name: "row"; type: "int" }
|
||||
Parameter { name: "column"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "parent"
|
||||
type: "QModelIndex"
|
||||
Parameter { name: "child"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "sibling"
|
||||
type: "QModelIndex"
|
||||
Parameter { name: "row"; type: "int" }
|
||||
Parameter { name: "column"; type: "int" }
|
||||
Parameter { name: "idx"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "rowCount"
|
||||
type: "int"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method { name: "rowCount"; type: "int" }
|
||||
Method {
|
||||
name: "columnCount"
|
||||
type: "int"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method { name: "columnCount"; type: "int" }
|
||||
Method {
|
||||
name: "hasChildren"
|
||||
type: "bool"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method { name: "hasChildren"; type: "bool" }
|
||||
Method {
|
||||
name: "data"
|
||||
type: "QVariant"
|
||||
Parameter { name: "index"; type: "QModelIndex" }
|
||||
Parameter { name: "role"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "data"
|
||||
type: "QVariant"
|
||||
Parameter { name: "index"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "setData"
|
||||
type: "bool"
|
||||
Parameter { name: "index"; type: "QModelIndex" }
|
||||
Parameter { name: "value"; type: "QVariant" }
|
||||
Parameter { name: "role"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "setData"
|
||||
type: "bool"
|
||||
Parameter { name: "index"; type: "QModelIndex" }
|
||||
Parameter { name: "value"; type: "QVariant" }
|
||||
}
|
||||
Method {
|
||||
name: "headerData"
|
||||
type: "QVariant"
|
||||
Parameter { name: "section"; type: "int" }
|
||||
Parameter { name: "orientation"; type: "Qt::Orientation" }
|
||||
Parameter { name: "role"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "headerData"
|
||||
type: "QVariant"
|
||||
Parameter { name: "section"; type: "int" }
|
||||
Parameter { name: "orientation"; type: "Qt::Orientation" }
|
||||
}
|
||||
Method {
|
||||
name: "fetchMore"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "canFetchMore"
|
||||
type: "bool"
|
||||
Parameter { name: "parent"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "flags"
|
||||
type: "Qt::ItemFlags"
|
||||
Parameter { name: "index"; type: "QModelIndex" }
|
||||
}
|
||||
Method {
|
||||
name: "match"
|
||||
type: "QModelIndexList"
|
||||
Parameter { name: "start"; type: "QModelIndex" }
|
||||
Parameter { name: "role"; type: "int" }
|
||||
Parameter { name: "value"; type: "QVariant" }
|
||||
Parameter { name: "hits"; type: "int" }
|
||||
Parameter { name: "flags"; type: "Qt::MatchFlags" }
|
||||
}
|
||||
Method {
|
||||
name: "match"
|
||||
type: "QModelIndexList"
|
||||
Parameter { name: "start"; type: "QModelIndex" }
|
||||
Parameter { name: "role"; type: "int" }
|
||||
Parameter { name: "value"; type: "QVariant" }
|
||||
Parameter { name: "hits"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "match"
|
||||
type: "QModelIndexList"
|
||||
Parameter { name: "start"; type: "QModelIndex" }
|
||||
Parameter { name: "role"; type: "int" }
|
||||
Parameter { name: "value"; type: "QVariant" }
|
||||
}
|
||||
}
|
||||
Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" }
|
||||
Component {
|
||||
name: "QQuickFontListModel"
|
||||
prototype: "QAbstractListModel"
|
||||
exports: ["QtQuick.Dialogs.Private/FontListModel 1.1"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "writingSystem"; type: "string" }
|
||||
Property { name: "scalableFonts"; type: "bool" }
|
||||
Property { name: "nonScalableFonts"; type: "bool" }
|
||||
Property { name: "monospacedFonts"; type: "bool" }
|
||||
Property { name: "proportionalFonts"; type: "bool" }
|
||||
Property { name: "count"; type: "int"; isReadonly: true }
|
||||
Signal { name: "rowCountChanged" }
|
||||
Method {
|
||||
name: "setScalableFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setNonScalableFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setMonospacedFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setProportionalFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "get"
|
||||
type: "QJSValue"
|
||||
Parameter { name: "index"; type: "int" }
|
||||
}
|
||||
Method { name: "pointSizes"; type: "QJSValue" }
|
||||
}
|
||||
Component {
|
||||
name: "QQuickWritingSystemListModel"
|
||||
prototype: "QAbstractListModel"
|
||||
exports: ["QtQuick.Dialogs.Private/WritingSystemListModel 1.1"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "writingSystems"; type: "QStringList"; isReadonly: true }
|
||||
Property { name: "count"; type: "int"; isReadonly: true }
|
||||
Signal { name: "rowCountChanged" }
|
||||
Method {
|
||||
name: "get"
|
||||
type: "QJSValue"
|
||||
Parameter { name: "index"; type: "int" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
module QtQuick.Dialogs.Private
|
||||
plugin dialogsprivateplugin
|
||||
classname QtQuick2DialogsPrivatePlugin
|
||||
typeinfo plugins.qmltypes
|
||||
@@ -0,0 +1,43 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.PrivateWidgets 1.0
|
||||
|
||||
QtColorDialog { }
|
||||
@@ -0,0 +1,43 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.PrivateWidgets 1.0
|
||||
|
||||
QtFileDialog { }
|
||||
@@ -0,0 +1,43 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.PrivateWidgets 1.1
|
||||
|
||||
QtFontDialog { }
|
||||
@@ -0,0 +1,43 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.PrivateWidgets 1.1
|
||||
|
||||
QtMessageDialog { }
|
||||
|
After Width: | Height: | Size: 80 B |
|
After Width: | Height: | Size: 809 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 876 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 623 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 371 B |
@@ -0,0 +1,484 @@
|
||||
import QtQuick.tooling 1.2
|
||||
|
||||
// This file describes the plugin-supplied types contained in the library.
|
||||
// It is used for QML tooling purposes only.
|
||||
//
|
||||
// This file was auto-generated by:
|
||||
// 'qmlplugindump -nonrelocatable QtQuick.Dialogs 1.3'
|
||||
|
||||
Module {
|
||||
dependencies: [
|
||||
"Qt.labs.folderlistmodel 2.1",
|
||||
"Qt.labs.settings 1.0",
|
||||
"QtGraphicalEffects 1.12",
|
||||
"QtQml 2.14",
|
||||
"QtQml.Models 2.2",
|
||||
"QtQuick 2.9",
|
||||
"QtQuick.Controls 1.5",
|
||||
"QtQuick.Controls.Styles 1.4",
|
||||
"QtQuick.Extras 1.4",
|
||||
"QtQuick.Layouts 1.1",
|
||||
"QtQuick.Window 2.2"
|
||||
]
|
||||
Component {
|
||||
name: "QQuickAbstractColorDialog"
|
||||
prototype: "QQuickAbstractDialog"
|
||||
Property { name: "showAlphaChannel"; type: "bool" }
|
||||
Property { name: "color"; type: "QColor" }
|
||||
Property { name: "currentColor"; type: "QColor" }
|
||||
Property { name: "currentHue"; type: "double"; isReadonly: true }
|
||||
Property { name: "currentSaturation"; type: "double"; isReadonly: true }
|
||||
Property { name: "currentLightness"; type: "double"; isReadonly: true }
|
||||
Property { name: "currentAlpha"; type: "double"; isReadonly: true }
|
||||
Signal { name: "selectionAccepted" }
|
||||
Method {
|
||||
name: "setVisible"
|
||||
Parameter { name: "v"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setModality"
|
||||
Parameter { name: "m"; type: "Qt::WindowModality" }
|
||||
}
|
||||
Method {
|
||||
name: "setTitle"
|
||||
Parameter { name: "t"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setColor"
|
||||
Parameter { name: "arg"; type: "QColor" }
|
||||
}
|
||||
Method {
|
||||
name: "setCurrentColor"
|
||||
Parameter { name: "currentColor"; type: "QColor" }
|
||||
}
|
||||
Method {
|
||||
name: "setShowAlphaChannel"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QQuickAbstractDialog"
|
||||
prototype: "QObject"
|
||||
Enum {
|
||||
name: "StandardButton"
|
||||
values: {
|
||||
"NoButton": 0,
|
||||
"Ok": 1024,
|
||||
"Save": 2048,
|
||||
"SaveAll": 4096,
|
||||
"Open": 8192,
|
||||
"Yes": 16384,
|
||||
"YesToAll": 32768,
|
||||
"No": 65536,
|
||||
"NoToAll": 131072,
|
||||
"Abort": 262144,
|
||||
"Retry": 524288,
|
||||
"Ignore": 1048576,
|
||||
"Close": 2097152,
|
||||
"Cancel": 4194304,
|
||||
"Discard": 8388608,
|
||||
"Help": 16777216,
|
||||
"Apply": 33554432,
|
||||
"Reset": 67108864,
|
||||
"RestoreDefaults": 134217728,
|
||||
"NButtons": 134217729
|
||||
}
|
||||
}
|
||||
Enum {
|
||||
name: "StandardButtons"
|
||||
values: {
|
||||
"NoButton": 0,
|
||||
"Ok": 1024,
|
||||
"Save": 2048,
|
||||
"SaveAll": 4096,
|
||||
"Open": 8192,
|
||||
"Yes": 16384,
|
||||
"YesToAll": 32768,
|
||||
"No": 65536,
|
||||
"NoToAll": 131072,
|
||||
"Abort": 262144,
|
||||
"Retry": 524288,
|
||||
"Ignore": 1048576,
|
||||
"Close": 2097152,
|
||||
"Cancel": 4194304,
|
||||
"Discard": 8388608,
|
||||
"Help": 16777216,
|
||||
"Apply": 33554432,
|
||||
"Reset": 67108864,
|
||||
"RestoreDefaults": 134217728,
|
||||
"NButtons": 134217729
|
||||
}
|
||||
}
|
||||
Property { name: "visible"; type: "bool" }
|
||||
Property { name: "modality"; type: "Qt::WindowModality" }
|
||||
Property { name: "title"; type: "string" }
|
||||
Property { name: "isWindow"; type: "bool"; isReadonly: true }
|
||||
Property { name: "x"; type: "int" }
|
||||
Property { name: "y"; type: "int" }
|
||||
Property { name: "width"; type: "int" }
|
||||
Property { name: "height"; type: "int" }
|
||||
Property { name: "__maximumDimension"; type: "int"; isReadonly: true }
|
||||
Signal { name: "visibilityChanged" }
|
||||
Signal { name: "geometryChanged" }
|
||||
Signal { name: "accepted" }
|
||||
Signal { name: "rejected" }
|
||||
Method { name: "open" }
|
||||
Method { name: "close" }
|
||||
Method {
|
||||
name: "setX"
|
||||
Parameter { name: "arg"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "setY"
|
||||
Parameter { name: "arg"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "setWidth"
|
||||
Parameter { name: "arg"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "setHeight"
|
||||
Parameter { name: "arg"; type: "int" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QQuickAbstractFileDialog"
|
||||
prototype: "QQuickAbstractDialog"
|
||||
Property { name: "selectExisting"; type: "bool" }
|
||||
Property { name: "selectMultiple"; type: "bool" }
|
||||
Property { name: "selectFolder"; type: "bool" }
|
||||
Property { name: "folder"; type: "QUrl" }
|
||||
Property { name: "nameFilters"; type: "QStringList" }
|
||||
Property { name: "selectedNameFilter"; type: "string" }
|
||||
Property { name: "selectedNameFilterExtensions"; type: "QStringList"; isReadonly: true }
|
||||
Property { name: "selectedNameFilterIndex"; type: "int" }
|
||||
Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
|
||||
Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
|
||||
Property { name: "sidebarVisible"; type: "bool" }
|
||||
Property { name: "defaultSuffix"; type: "string" }
|
||||
Property { name: "shortcuts"; type: "QJSValue"; isReadonly: true }
|
||||
Property { name: "__shortcuts"; type: "QJSValue"; isReadonly: true }
|
||||
Signal { name: "filterSelected" }
|
||||
Signal { name: "fileModeChanged" }
|
||||
Signal { name: "selectionAccepted" }
|
||||
Method {
|
||||
name: "setVisible"
|
||||
Parameter { name: "v"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setTitle"
|
||||
Parameter { name: "t"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setSelectExisting"
|
||||
Parameter { name: "s"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setSelectMultiple"
|
||||
Parameter { name: "s"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setSelectFolder"
|
||||
Parameter { name: "s"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setFolder"
|
||||
Parameter { name: "f"; type: "QUrl" }
|
||||
}
|
||||
Method {
|
||||
name: "setNameFilters"
|
||||
Parameter { name: "f"; type: "QStringList" }
|
||||
}
|
||||
Method {
|
||||
name: "selectNameFilter"
|
||||
Parameter { name: "f"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setSelectedNameFilterIndex"
|
||||
Parameter { name: "idx"; type: "int" }
|
||||
}
|
||||
Method {
|
||||
name: "setSidebarVisible"
|
||||
Parameter { name: "s"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setDefaultSuffix"
|
||||
Parameter { name: "suffix"; type: "string" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QQuickAbstractFontDialog"
|
||||
prototype: "QQuickAbstractDialog"
|
||||
Property { name: "scalableFonts"; type: "bool" }
|
||||
Property { name: "nonScalableFonts"; type: "bool" }
|
||||
Property { name: "monospacedFonts"; type: "bool" }
|
||||
Property { name: "proportionalFonts"; type: "bool" }
|
||||
Property { name: "font"; type: "QFont" }
|
||||
Property { name: "currentFont"; type: "QFont" }
|
||||
Signal { name: "selectionAccepted" }
|
||||
Method {
|
||||
name: "setVisible"
|
||||
Parameter { name: "v"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setModality"
|
||||
Parameter { name: "m"; type: "Qt::WindowModality" }
|
||||
}
|
||||
Method {
|
||||
name: "setTitle"
|
||||
Parameter { name: "t"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setFont"
|
||||
Parameter { name: "arg"; type: "QFont" }
|
||||
}
|
||||
Method {
|
||||
name: "setCurrentFont"
|
||||
Parameter { name: "arg"; type: "QFont" }
|
||||
}
|
||||
Method {
|
||||
name: "setScalableFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setNonScalableFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setMonospacedFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setProportionalFonts"
|
||||
Parameter { name: "arg"; type: "bool" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QQuickAbstractMessageDialog"
|
||||
prototype: "QQuickAbstractDialog"
|
||||
Enum {
|
||||
name: "Icon"
|
||||
values: {
|
||||
"NoIcon": 0,
|
||||
"Information": 1,
|
||||
"Warning": 2,
|
||||
"Critical": 3,
|
||||
"Question": 4
|
||||
}
|
||||
}
|
||||
Property { name: "text"; type: "string" }
|
||||
Property { name: "informativeText"; type: "string" }
|
||||
Property { name: "detailedText"; type: "string" }
|
||||
Property { name: "icon"; type: "Icon" }
|
||||
Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
|
||||
Property { name: "standardButtons"; type: "QQuickAbstractDialog::StandardButtons" }
|
||||
Property {
|
||||
name: "clickedButton"
|
||||
type: "QQuickAbstractDialog::StandardButton"
|
||||
isReadonly: true
|
||||
}
|
||||
Signal { name: "buttonClicked" }
|
||||
Signal { name: "discard" }
|
||||
Signal { name: "help" }
|
||||
Signal { name: "yes" }
|
||||
Signal { name: "no" }
|
||||
Signal { name: "apply" }
|
||||
Signal { name: "reset" }
|
||||
Method {
|
||||
name: "setVisible"
|
||||
Parameter { name: "v"; type: "bool" }
|
||||
}
|
||||
Method {
|
||||
name: "setTitle"
|
||||
Parameter { name: "arg"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setText"
|
||||
Parameter { name: "arg"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setInformativeText"
|
||||
Parameter { name: "arg"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setDetailedText"
|
||||
Parameter { name: "arg"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setIcon"
|
||||
Parameter { name: "icon"; type: "Icon" }
|
||||
}
|
||||
Method {
|
||||
name: "setStandardButtons"
|
||||
Parameter { name: "buttons"; type: "StandardButtons" }
|
||||
}
|
||||
Method {
|
||||
name: "click"
|
||||
Parameter { name: "button"; type: "QQuickAbstractDialog::StandardButton" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QQuickColorDialog"
|
||||
defaultProperty: "contentItem"
|
||||
prototype: "QQuickAbstractColorDialog"
|
||||
exports: ["QtQuick.Dialogs/AbstractColorDialog 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
|
||||
}
|
||||
Component {
|
||||
name: "QQuickDialog1"
|
||||
defaultProperty: "contentItem"
|
||||
prototype: "QQuickAbstractDialog"
|
||||
exports: ["QtQuick.Dialogs/AbstractDialog 1.2"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "title"; type: "string" }
|
||||
Property { name: "standardButtons"; type: "QQuickAbstractDialog::StandardButtons" }
|
||||
Property {
|
||||
name: "clickedButton"
|
||||
type: "QQuickAbstractDialog::StandardButton"
|
||||
isReadonly: true
|
||||
}
|
||||
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
|
||||
Signal { name: "buttonClicked" }
|
||||
Signal { name: "discard" }
|
||||
Signal { name: "help" }
|
||||
Signal { name: "yes" }
|
||||
Signal { name: "no" }
|
||||
Signal { name: "apply" }
|
||||
Signal { name: "reset" }
|
||||
Method {
|
||||
name: "setTitle"
|
||||
Parameter { name: "arg"; type: "string" }
|
||||
}
|
||||
Method {
|
||||
name: "setStandardButtons"
|
||||
Parameter { name: "buttons"; type: "StandardButtons" }
|
||||
}
|
||||
Method {
|
||||
name: "click"
|
||||
Parameter { name: "button"; type: "QQuickAbstractDialog::StandardButton" }
|
||||
}
|
||||
Method { name: "__standardButtonsLeftModel"; type: "QJSValue" }
|
||||
Method { name: "__standardButtonsRightModel"; type: "QJSValue" }
|
||||
}
|
||||
Component {
|
||||
name: "QQuickFileDialog"
|
||||
defaultProperty: "contentItem"
|
||||
prototype: "QQuickAbstractFileDialog"
|
||||
exports: ["QtQuick.Dialogs/AbstractFileDialog 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
|
||||
Method { name: "clearSelection" }
|
||||
Method {
|
||||
name: "addSelection"
|
||||
type: "bool"
|
||||
Parameter { name: "path"; type: "QUrl" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QQuickFontDialog"
|
||||
defaultProperty: "contentItem"
|
||||
prototype: "QQuickAbstractFontDialog"
|
||||
exports: ["QtQuick.Dialogs/AbstractFontDialog 1.1"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
|
||||
}
|
||||
Component {
|
||||
name: "QQuickMessageDialog"
|
||||
defaultProperty: "contentItem"
|
||||
prototype: "QQuickAbstractMessageDialog"
|
||||
exports: ["QtQuick.Dialogs/AbstractMessageDialog 1.1"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
|
||||
}
|
||||
Component {
|
||||
name: "QQuickStandardButton"
|
||||
exports: ["QtQuick.Dialogs/StandardButton 1.1"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
}
|
||||
Component {
|
||||
name: "QQuickStandardIcon"
|
||||
exports: ["QtQuick.Dialogs/StandardIcon 1.1"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickColorDialog"
|
||||
name: "QtQuick.Dialogs/ColorDialog 1.0"
|
||||
exports: ["QtQuick.Dialogs/ColorDialog 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
isComposite: true
|
||||
defaultProperty: "contentItem"
|
||||
Property { name: "__valueSet"; type: "bool" }
|
||||
Method { name: "__setControlsFromColor"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickDialog1"
|
||||
name: "QtQuick.Dialogs/Dialog 1.2"
|
||||
exports: ["QtQuick.Dialogs/Dialog 1.2"]
|
||||
exportMetaObjectRevisions: [2]
|
||||
isComposite: true
|
||||
defaultProperty: "data"
|
||||
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
|
||||
Signal {
|
||||
name: "actionChosen"
|
||||
Parameter { name: "action"; type: "QVariant" }
|
||||
}
|
||||
Method { name: "setupButtons"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickDialog1"
|
||||
name: "QtQuick.Dialogs/Dialog 1.3"
|
||||
exports: ["QtQuick.Dialogs/Dialog 1.3"]
|
||||
exportMetaObjectRevisions: [3]
|
||||
isComposite: true
|
||||
defaultProperty: "data"
|
||||
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
|
||||
Signal {
|
||||
name: "actionChosen"
|
||||
Parameter { name: "action"; type: "QVariant" }
|
||||
}
|
||||
Method { name: "setupButtons"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickFileDialog"
|
||||
name: "QtQuick.Dialogs/FileDialog 1.0"
|
||||
exports: ["QtQuick.Dialogs/FileDialog 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
isComposite: true
|
||||
defaultProperty: "contentItem"
|
||||
Property { name: "modelComponent"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "settings"; type: "QQmlSettings"; isPointer: true }
|
||||
Property { name: "showFocusHighlight"; type: "bool" }
|
||||
Property { name: "palette"; type: "QQuickSystemPalette"; isPointer: true }
|
||||
Property { name: "favoriteFolders"; type: "QVariant" }
|
||||
Property { name: "dirUpAction"; type: "QQuickAction1"; isPointer: true }
|
||||
Method {
|
||||
name: "dirDown"
|
||||
type: "QVariant"
|
||||
Parameter { name: "path"; type: "QVariant" }
|
||||
}
|
||||
Method { name: "dirUp"; type: "QVariant" }
|
||||
Method { name: "acceptSelection"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickFontDialog"
|
||||
name: "QtQuick.Dialogs/FontDialog 1.1"
|
||||
exports: ["QtQuick.Dialogs/FontDialog 1.1"]
|
||||
exportMetaObjectRevisions: [1]
|
||||
isComposite: true
|
||||
defaultProperty: "contentItem"
|
||||
Property { name: "font"; type: "QFont" }
|
||||
Property { name: "currentFont"; type: "QFont" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickMessageDialog"
|
||||
name: "QtQuick.Dialogs/MessageDialog 1.1"
|
||||
exports: ["QtQuick.Dialogs/MessageDialog 1.1"]
|
||||
exportMetaObjectRevisions: [1]
|
||||
isComposite: true
|
||||
defaultProperty: "contentItem"
|
||||
Method { name: "calculateImplicitWidth"; type: "QVariant" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
|
||||
Item {
|
||||
id: colorSlider
|
||||
|
||||
property real value: 1
|
||||
property real maximum: 1
|
||||
property real minimum: 0
|
||||
property string text: ""
|
||||
property bool pressed: mouseArea.pressed
|
||||
property bool integer: false
|
||||
property Component trackDelegate
|
||||
property string handleSource: "../images/slider_handle.png"
|
||||
|
||||
width: parent.width
|
||||
height: handle.height + textText.implicitHeight
|
||||
|
||||
function updatePos() {
|
||||
if (maximum > minimum) {
|
||||
var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5;
|
||||
return Math.min(Math.max(pos, 5), track.width - 5) - 10;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
|
||||
Column {
|
||||
id: column
|
||||
width: parent.width
|
||||
spacing: 12
|
||||
Text {
|
||||
id: textText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: colorSlider.text
|
||||
anchors.left: parent.left
|
||||
color: palette.windowText
|
||||
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
}
|
||||
|
||||
Item {
|
||||
id: track
|
||||
height: 8
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Loader {
|
||||
sourceComponent: trackDelegate
|
||||
width: parent.height
|
||||
height: parent.width
|
||||
y: width
|
||||
}
|
||||
|
||||
BorderImage {
|
||||
source: "../images/sunken_frame.png"
|
||||
border.left: 8
|
||||
border.right: 8
|
||||
border.top:8
|
||||
border.bottom: 8
|
||||
anchors.fill: track
|
||||
anchors.margins: -1
|
||||
anchors.topMargin: -2
|
||||
anchors.leftMargin: -2
|
||||
}
|
||||
|
||||
Image {
|
||||
id: handle
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
smooth: true
|
||||
source: "../images/slider_handle.png"
|
||||
x: updatePos() - 8
|
||||
z: 1
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors {left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
|
||||
height: handle.height
|
||||
width: handle.width
|
||||
preventStealing: true
|
||||
|
||||
onPressed: {
|
||||
var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
|
||||
var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
|
||||
value = colorSlider.integer ? Math.round(realValue) : realValue;
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
if (pressed) {
|
||||
var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
|
||||
var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
|
||||
value = colorSlider.integer ? Math.round(realValue) : realValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
|
||||
Rectangle {
|
||||
color: "#80000000"
|
||||
anchors.fill: parent
|
||||
z: 1000000
|
||||
property alias content: borderImage.content
|
||||
property bool dismissOnOuterClick: true
|
||||
signal dismissed
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: if (dismissOnOuterClick) dismissed()
|
||||
BorderImage {
|
||||
id: borderImage
|
||||
property Item content
|
||||
|
||||
MouseArea { anchors.fill: parent }
|
||||
|
||||
width: content ? content.width + 15 : 0
|
||||
height: content ? content.height + 15 : 0
|
||||
onWidthChanged: if (content) content.x = 5
|
||||
onHeightChanged: if (content) content.y = 5
|
||||
border { left: 10; top: 10; right: 10; bottom: 10 }
|
||||
clip: true
|
||||
source: "../images/window_border.png"
|
||||
anchors.centerIn: parent
|
||||
onContentChanged: if (content) content.parent = borderImage
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
|
||||
ButtonStyle {
|
||||
FontLoader { id: iconFont; source: "icons.ttf" }
|
||||
|
||||
label: Text {
|
||||
id: text
|
||||
font.family: iconFont.name
|
||||
font.pointSize: TextSingleton.font.pointSize * 1.5
|
||||
renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering
|
||||
text: control.text
|
||||
color: SystemPaletteSingleton.buttonText(control.enabled)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
|
||||
Text {
|
||||
id: icon
|
||||
width: height
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.family: iconFont.name
|
||||
property alias unicode: icon.text
|
||||
FontLoader { id: iconFont; source: "icons.ttf"; onNameChanged: console.log("custom font" + name) }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
ColorSlider 1.0 ColorSlider.qml
|
||||
IconButtonStyle 1.0 IconButtonStyle.qml
|
||||
IconGlyph 1.0 IconGlyph.qml
|
||||
@@ -0,0 +1,10 @@
|
||||
module QtQuick.Dialogs
|
||||
plugin dialogplugin
|
||||
classname QtQuick2DialogsPlugin
|
||||
typeinfo plugins.qmltypes
|
||||
depends Qt.labs.folderlistmodel 1.0
|
||||
depends Qt.labs.settings 1.0
|
||||
depends QtQuick.Dialogs.Private 1.0
|
||||
depends QtQuick.Controls 1.3
|
||||
depends QtQuick.PrivateWidgets 1.1
|
||||
depends QtQml 2.14
|
||||