summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/controls/ApplicationWindow.qml2
-rw-r--r--src/controls/Calendar.qml8
-rw-r--r--src/controls/ComboBox.qml1
-rw-r--r--src/controls/Private/FastGlow.qml71
-rw-r--r--src/controls/Private/TabBar.qml14
-rw-r--r--src/controls/Private/TextHandle.qml91
-rw-r--r--src/controls/Private/private.pri1
-rw-r--r--src/controls/Private/qmldir1
-rw-r--r--src/controls/Private/qquickcontrolsprivate_p.h2
-rw-r--r--src/controls/Private/qquickrangemodel.cpp18
-rw-r--r--src/controls/Private/qquickrangemodel_p.h2
-rw-r--r--src/controls/Private/qquickstyleitem.cpp12
-rw-r--r--src/controls/Slider.qml16
-rw-r--r--src/controls/SpinBox.qml1
-rw-r--r--src/controls/SplitView.qml49
-rw-r--r--src/controls/StatusBar.qml26
-rw-r--r--src/controls/Styles/Base/CalendarStyle.qml11
-rw-r--r--src/controls/Styles/Base/ScrollViewStyle.qml8
-rw-r--r--src/controls/Styles/Base/SpinBoxStyle.qml2
-rw-r--r--src/controls/Styles/Base/TabViewStyle.qml1
-rw-r--r--src/controls/Styles/Base/TextAreaStyle.qml34
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml34
-rw-r--r--src/controls/Styles/Desktop/CheckBoxStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/RadioButtonStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/SpinBoxStyle.qml2
-rw-r--r--src/controls/Switch.qml17
-rw-r--r--src/controls/TabView.qml10
-rw-r--r--src/controls/TextArea.qml155
-rw-r--r--src/controls/TextField.qml130
-rw-r--r--src/controls/ToolBar.qml26
-rw-r--r--src/controls/doc/qtquickcontrols.qdocconf2
-rw-r--r--src/controls/plugin.cpp4
-rw-r--r--src/dialogs/DefaultColorDialog.qml49
-rw-r--r--src/dialogs/doc/qtquickdialogs.qdocconf2
-rw-r--r--src/layouts/doc/qtquicklayouts.qdocconf2
35 files changed, 728 insertions, 80 deletions
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
index 240965c4..5ac73fbe 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick.Window 2.1
+import QtQuick.Window 2.2
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.0
diff --git a/src/controls/Calendar.qml b/src/controls/Calendar.qml
index 11b20b37..bd376c10 100644
--- a/src/controls/Calendar.qml
+++ b/src/controls/Calendar.qml
@@ -168,6 +168,14 @@ Control {
property bool weekNumbersVisible: false
/*!
+ This property determines the visibility of the navigation bar.
+ \since QtQuick.Controls 1.3
+
+ The default value is \c true.
+ */
+ property bool navigationBarVisible: true
+
+ /*!
\qmlproperty enum Calendar::dayOfWeekFormat
The format in which the days of the week (in the header) are displayed.
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index cc949153..995cdcde 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -369,6 +369,7 @@ Control {
verticalAlignment: Text.AlignVCenter
+ font: __style && __style.editorFont !== undefined ? __style.editorFont : TextSingleton.font
renderType: __style ? __style.renderType : Text.NativeRendering
selectByMouse: true
color: SystemPaletteSingleton.text(enabled)
diff --git a/src/controls/Private/FastGlow.qml b/src/controls/Private/FastGlow.qml
index 5b3b4881..6fcb6d4b 100644
--- a/src/controls/Private/FastGlow.qml
+++ b/src/controls/Private/FastGlow.qml
@@ -64,7 +64,25 @@ Item {
hideSource: visible
}
- property string __internalBlurVertexShader: "
+ property string __internalBlurVertexShader: rootItem.window.glslIsCoreProfile ? "#version 150
+ in vec4 qt_Vertex;
+ in vec2 qt_MultiTexCoord0;
+ uniform mat4 qt_Matrix;
+ uniform float yStep;
+ uniform float xStep;
+ out vec2 qt_TexCoord0;
+ out vec2 qt_TexCoord1;
+ out vec2 qt_TexCoord2;
+ out vec2 qt_TexCoord3;
+
+ void main() {
+ qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36);
+ qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep);
+ qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep);
+ qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36);
+ gl_Position = qt_Matrix * qt_Vertex;
+ }
+ " : "
attribute highp vec4 qt_Vertex;
attribute highp vec2 qt_MultiTexCoord0;
uniform highp mat4 qt_Matrix;
@@ -83,8 +101,23 @@ Item {
gl_Position = qt_Matrix * qt_Vertex;
}
"
+ property string __internalBlurFragmentShader: rootItem.window.glslIsCoreProfile ? "#version 150
+ uniform sampler2D source;
+ uniform float qt_Opacity;
+ in vec2 qt_TexCoord0;
+ in vec2 qt_TexCoord1;
+ in vec2 qt_TexCoord2;
+ in vec2 qt_TexCoord3;
+ out vec4 fragColor;
- property string __internalBlurFragmentShader: "
+ void main() {
+ vec4 sourceColor = (texture(source, qt_TexCoord0) +
+ texture(source, qt_TexCoord1) +
+ texture(source, qt_TexCoord2) +
+ texture(source, qt_TexCoord3)) * 0.25;
+ fragColor = sourceColor * qt_Opacity;
+ }
+ " : "
uniform lowp sampler2D source;
uniform lowp float qt_Opacity;
varying highp vec2 qt_TexCoord0;
@@ -99,7 +132,7 @@ Item {
texture2D(source, qt_TexCoord3)) * 0.25;
gl_FragColor = sourceColor * qt_Opacity;
}
- "
+ "
ShaderEffect {
id: level0
@@ -359,7 +392,37 @@ Item {
onLodChanged: calculateWeights()
- fragmentShader: "
+ fragmentShader: rootItem.window.glslIsCoreProfile ? "#version 150
+ uniform sampler2D source1;
+ uniform sampler2D source2;
+ uniform sampler2D source3;
+ uniform sampler2D source4;
+ uniform sampler2D source5;
+ uniform float weight1;
+ uniform float weight2;
+ uniform float weight3;
+ uniform float weight4;
+ uniform float weight5;
+ uniform vec4 color;
+ uniform float spread;
+ uniform float qt_Opacity;
+ in vec2 qt_TexCoord0;
+ out vec4 fragColor;
+
+ float linearstep(float e0, float e1, float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+ }
+
+ void main() {
+ vec4 sourceColor = texture(source1, qt_TexCoord0) * weight1;
+ sourceColor += texture(source2, qt_TexCoord0) * weight2;
+ sourceColor += texture(source3, qt_TexCoord0) * weight3;
+ sourceColor += texture(source4, qt_TexCoord0) * weight4;
+ sourceColor += texture(source5, qt_TexCoord0) * weight5;
+ sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a));
+ fragColor = sourceColor * qt_Opacity;
+ }
+ " : "
uniform lowp sampler2D source1;
uniform lowp sampler2D source2;
uniform lowp sampler2D source3;
diff --git a/src/controls/Private/TabBar.qml b/src/controls/Private/TabBar.qml
index 540b994f..0d289e05 100644
--- a/src/controls/Private/TabBar.qml
+++ b/src/controls/Private/TabBar.qml
@@ -187,6 +187,9 @@ FocusScope {
property bool nextSelected: tabView.currentIndex === index + 1
property bool previousSelected: tabView.currentIndex === index - 1
+ property bool keyPressed: false
+ property bool effectivePressed: pressed && containsMouse || keyPressed
+
z: selected ? 1 : -index
implicitWidth: tabloader.implicitWidth
implicitHeight: tabloader.implicitHeight
@@ -209,6 +212,16 @@ FocusScope {
}
}
+ Keys.onPressed: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && !tabitem.pressed)
+ tabitem.keyPressed = true
+ }
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Space && !event.isAutoRepeat && tabitem.keyPressed)
+ tabitem.keyPressed = false
+ }
+ onFocusChanged: if (!focus) tabitem.keyPressed = false
+
Loader {
id: tabloader
@@ -221,6 +234,7 @@ FocusScope {
readonly property alias title: tabitem.title
readonly property alias nextSelected: tabitem.nextSelected
readonly property alias previousSelected: tabitem.previousSelected
+ readonly property alias pressed: tabitem.effectivePressed
readonly property alias hovered: tabitem.containsMouse
readonly property alias enabled: tabitem.enabled
readonly property bool activeFocus: tabitem.activeFocus
diff --git a/src/controls/Private/TextHandle.qml b/src/controls/Private/TextHandle.qml
new file mode 100644
index 00000000..34daa4ab
--- /dev/null
+++ b/src/controls/Private/TextHandle.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.2
+
+Loader {
+ id: handle
+
+ property Item editor
+ property int minimum: -1
+ property int maximum: -1
+ property int position: -1
+ property alias delegate: handle.sourceComponent
+
+ readonly property alias pressed: mouse.pressed
+
+ readonly property real handleX: x + (item ? item.x : 0)
+ readonly property real handleY: y + (item ? item.y : 0)
+ readonly property real handleWidth: item ? item.width : 0
+ readonly property real handleHeight: item ? item.height : 0
+
+ property Item control
+ property QtObject styleData: QtObject {
+ readonly property alias pressed: mouse.pressed
+ readonly property alias position: handle.position
+ readonly property real lineHeight: position !== -1 ? editor.positionToRectangle(position).height
+ : editor.cursorRectangle.height
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: item
+ property point offset
+ onPressed: offset = Qt.point(x + mouse.x, y + mouse.y)
+ onPositionChanged: {
+ var pt = mapToItem(editor, mouse.x - offset.x, mouse.y - offset.y)
+
+ // limit vertically within mix/max coordinates or content bounds
+ var min = (minimum !== -1) ? minimum : 0
+ var max = (maximum !== -1) ? maximum : editor.length - 1
+ pt.y = Math.max(pt.y, editor.positionToRectangle(min).y)
+ pt.y = Math.min(pt.y, editor.positionToRectangle(max).y)
+
+ var pos = editor.positionAt(pt.x, pt.y)
+
+ // limit horizontally within min/max character positions
+ if (minimum !== -1)
+ pos = Math.max(pos, minimum)
+ if (maximum !== -1)
+ pos = Math.min(pos, maximum)
+
+ handle.position = pos
+ }
+ }
+}
diff --git a/src/controls/Private/private.pri b/src/controls/Private/private.pri
index 32ad0cf6..e409ee4a 100644
--- a/src/controls/Private/private.pri
+++ b/src/controls/Private/private.pri
@@ -48,6 +48,7 @@ PRIVATE_QML_FILES += \
$$PWD/ScrollBar.qml \
$$PWD/SystemPaletteSingleton.qml \
$$PWD/TableViewSelection.qml \
+ $$PWD/TextHandle.qml \
$$PWD/TextSingleton.qml \
$$PWD/FocusFrame.qml \
$$PWD/ColumnMenuContent.qml \
diff --git a/src/controls/Private/qmldir b/src/controls/Private/qmldir
index f2c572f2..a40e2b4c 100644
--- a/src/controls/Private/qmldir
+++ b/src/controls/Private/qmldir
@@ -26,3 +26,4 @@ ContentItem 1.0 ContentItem.qml
HoverButton 1.0 HoverButton.qml
singleton SystemPaletteSingleton 1.0 SystemPaletteSingleton.qml
singleton TextSingleton 1.0 TextSingleton.qml
+TextHandle 1.0 TextHandle.qml
diff --git a/src/controls/Private/qquickcontrolsprivate_p.h b/src/controls/Private/qquickcontrolsprivate_p.h
index 068b2a21..18f4ed36 100644
--- a/src/controls/Private/qquickcontrolsprivate_p.h
+++ b/src/controls/Private/qquickcontrolsprivate_p.h
@@ -43,6 +43,8 @@
#define QQUICKCONTROLSPRIVATE_P_H
#include "qqml.h"
+#include "qquicktooltip_p.h"
+#include "qquickcontrolsettings_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/controls/Private/qquickrangemodel.cpp b/src/controls/Private/qquickrangemodel.cpp
index ee1ade32..356fe080 100644
--- a/src/controls/Private/qquickrangemodel.cpp
+++ b/src/controls/Private/qquickrangemodel.cpp
@@ -521,4 +521,22 @@ void QQuickRangeModel::toMaximum()
setValue(d->maximum);
}
+void QQuickRangeModel::increaseSingleStep()
+{
+ Q_D(const QQuickRangeModel);
+ if (qFuzzyIsNull(d->stepSize))
+ setValue(value() + (d->maximum - d->minimum)/10.0);
+ else
+ setValue(value() + d->stepSize);
+}
+
+void QQuickRangeModel::decreaseSingleStep()
+{
+ Q_D(const QQuickRangeModel);
+ if (qFuzzyIsNull(d->stepSize))
+ setValue(value() - (d->maximum - d->minimum)/10.0);
+ else
+ setValue(value() - d->stepSize);
+}
+
QT_END_NAMESPACE
diff --git a/src/controls/Private/qquickrangemodel_p.h b/src/controls/Private/qquickrangemodel_p.h
index a15843d7..6a05f22a 100644
--- a/src/controls/Private/qquickrangemodel_p.h
+++ b/src/controls/Private/qquickrangemodel_p.h
@@ -97,6 +97,8 @@ public Q_SLOTS:
void toMaximum();
void setValue(qreal value);
void setPosition(qreal position);
+ void increaseSingleStep();
+ void decreaseSingleStep();
Q_SIGNALS:
void valueChanged(qreal value);
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 4da6773a..b04eeaa9 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -50,6 +50,7 @@
#include <qsgsimpletexturenode.h>
#include <qquickwindow.h>
#include "private/qguiapplication_p.h"
+#include <QtQuick/private/qquickwindow_p.h>
#include <QtGui/qpa/qplatformtheme.h>
#include "../qquickmenuitem_p.h"
@@ -757,6 +758,15 @@ void QQuickStyleItem::initStyleOption()
if (m_horizontal)
m_styleoption->state |= QStyle::State_Horizontal;
+ // some styles don't draw a focus rectangle if
+ // QStyle::State_KeyboardFocusChange is not set
+ if (window()) {
+ Qt::FocusReason lastFocusReason = QQuickWindowPrivate::get(window())->lastFocusReason;
+ if (lastFocusReason == Qt::TabFocusReason || lastFocusReason == Qt::BacktabFocusReason) {
+ m_styleoption->state |= QStyle::State_KeyboardFocusChange;
+ }
+ }
+
if (sizeHint == "mini") {
m_styleoption->state |= QStyle::State_Mini;
} else if (sizeHint == "small") {
@@ -975,7 +985,7 @@ QSize QQuickStyleItem::sizeFromContents(int width, int height)
size = qApp->style()->sizeFromContents(QStyle::CT_SpinBox, m_styleoption, QSize(width, height + 5));
break;
}
-#endif // fall trough if not mac
+#endif // fall through if not mac
case Edit:
#ifdef Q_OS_OSX
if (style() =="mac") {
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index 0f7fc033..af5b89cd 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -177,13 +177,21 @@ Control {
activeFocusOnTab: true
Accessible.role: Accessible.Slider
+ /*! \internal */
+ function accessibleIncreaseAction() {
+ range.increaseSingleStep()
+ }
+ /*! \internal */
+ function accessibleDecreaseAction() {
+ range.decreaseSingleStep()
+ }
style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider)
- Keys.onRightPressed: if (__horizontal) value += (maximumValue - minimumValue)/10.0
- Keys.onLeftPressed: if (__horizontal) value -= (maximumValue - minimumValue)/10.0
- Keys.onUpPressed: if (!__horizontal) value += (maximumValue - minimumValue)/10.0
- Keys.onDownPressed: if (!__horizontal) value -= (maximumValue - minimumValue)/10.0
+ Keys.onRightPressed: if (__horizontal) range.increaseSingleStep()
+ Keys.onLeftPressed: if (__horizontal) range.decreaseSingleStep()
+ Keys.onUpPressed: if (!__horizontal) range.increaseSingleStep()
+ Keys.onDownPressed: if (!__horizontal) range.decreaseSingleStep()
RangeModel {
id: range
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index 6a8a9548..f4374bbb 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -278,6 +278,7 @@ Control {
onEditingFinished: spinbox.editingFinished()
+ font: __panel ? __panel.font : TextSingleton.font
color: __panel ? __panel.foregroundColor : "black"
selectionColor: __panel ? __panel.selectionColor : "black"
selectedTextColor: __panel ? __panel.selectedTextColor : "black"
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml
index dadff049..93f0a7e3 100644
--- a/src/controls/SplitView.qml
+++ b/src/controls/SplitView.qml
@@ -166,6 +166,18 @@ Item {
onHeightChanged: d.updateLayout()
onOrientationChanged: d.changeOrientation()
+ /*! Add an item to the end of the view.
+ \since QtQuick.Controls 1.3 */
+ function addItem(item) {
+ d.updateLayoutGuard = true
+
+ d.addItem_impl(item)
+
+ d.calculateImplicitSize()
+ d.updateLayoutGuard = false
+ d.updateFillIndex()
+ }
+
SystemPalette { id: pal }
QtObject {
@@ -185,28 +197,35 @@ Item {
property int fillIndex: -1
property bool updateLayoutGuard: true
+ function addItem_impl(item)
+ {
+ // temporarily set fillIndex to new item
+ fillIndex = __items.length
+ if (splitterItems.children.length > 0)
+ handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1})
+
+ item.parent = splitterItems
+
+ // should match disconnections in Component.onDestruction
+ item.widthChanged.connect(d.updateLayout)
+ item.heightChanged.connect(d.updateLayout)
+ item.Layout.maximumWidthChanged.connect(d.updateLayout)
+ item.Layout.minimumWidthChanged.connect(d.updateLayout)
+ item.Layout.maximumHeightChanged.connect(d.updateLayout)
+ item.Layout.minimumHeightChanged.connect(d.updateLayout)
+ item.visibleChanged.connect(d.updateFillIndex)
+ item.Layout.fillWidthChanged.connect(d.updateFillIndex)
+ item.Layout.fillHeightChanged.connect(d.updateFillIndex)
+ }
+
function init()
{
for (var i=0; i<__contents.length; ++i) {
var item = __contents[i];
if (!item.hasOwnProperty("x"))
continue
-
- if (splitterItems.children.length > 0)
- handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1})
- item.parent = splitterItems
+ addItem_impl(item)
i-- // item was removed from list
-
- // should match disconnections in Component.onDestruction
- item.widthChanged.connect(d.updateLayout)
- item.heightChanged.connect(d.updateLayout)
- item.Layout.maximumWidthChanged.connect(d.updateLayout)
- item.Layout.minimumWidthChanged.connect(d.updateLayout)
- item.Layout.maximumHeightChanged.connect(d.updateLayout)
- item.Layout.minimumHeightChanged.connect(d.updateLayout)
- item.visibleChanged.connect(d.updateFillIndex)
- item.Layout.fillWidthChanged.connect(d.updateFillIndex)
- item.Layout.fillHeightChanged.connect(d.updateFillIndex)
}
d.calculateImplicitSize()
diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml
index be4791bb..d5e82642 100644
--- a/src/controls/StatusBar.qml
+++ b/src/controls/StatusBar.qml
@@ -65,6 +65,7 @@ import QtQuick.Controls.Private 1.0
ApplicationWindow {
statusBar: StatusBar {
RowLayout {
+ anchors.fill: parent
Label { text: "Read Only" }
}
}
@@ -79,9 +80,10 @@ FocusScope {
Accessible.role: Accessible.StatusBar
width: parent ? parent.width : implicitWidth
- implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
- implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(),
- loader.item ? loader.item.implicitHeight : 19)
+ implicitWidth: container.leftMargin + container.rightMargin
+ + Math.max(container.layoutWidth, __panel ? __panel.implicitWidth : 0)
+ implicitHeight: container.topMargin + container.bottomMargin
+ + Math.max(container.layoutHeight, __panel ? __panel.implicitHeight : 0)
/*! \internal */
property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar)
@@ -90,6 +92,9 @@ FocusScope {
property alias __style: styleLoader.item
/*! \internal */
+ property Item __panel: panelLoader.item
+
+ /*! \internal */
default property alias __content: container.data
/*!
@@ -107,7 +112,7 @@ FocusScope {
data: [
Loader {
- id: loader
+ id: panelLoader
anchors.fill: parent
sourceComponent: styleLoader.item ? styleLoader.item.panel : null
onLoaded: item.z = -1
@@ -134,12 +139,11 @@ FocusScope {
property int rightMargin: __style ? __style.padding.right : 0
property Item layoutItem: container.children.length === 1 ? container.children[0] : null
- function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
- (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
- layoutItem.anchors.rightMargin : 0) :
- loader.item ? loader.item.implicitWidth: 0) }
- function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
- (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
- layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) }
+ property real layoutWidth: layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) : 0
+ property real layoutHeight: layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : 0
}]
}
diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml
index 56978ded..26ca2048 100644
--- a/src/controls/Styles/Base/CalendarStyle.qml
+++ b/src/controls/Styles/Base/CalendarStyle.qml
@@ -148,6 +148,12 @@ Style {
*/
property real __gridLineWidth: 1
+ /*! \internal */
+ property color __horizontalSeparatorColor: gridColor
+
+ /*! \internal */
+ property color __verticalSeparatorColor: gridColor
+
function __cellRectAt(index) {
return CalendarUtils.cellRectAt(index, control.__panel.columns, control.__panel.rows,
control.__panel.availableWidth, control.__panel.availableHeight, gridVisible ? __gridLineWidth : 0);
@@ -388,6 +394,7 @@ Style {
anchors.right: parent.right
anchors.top: parent.top
sourceComponent: navigationBar
+ active: control.navigationBarVisible
property QtObject styleData: QtObject {
readonly property string title: control.__locale.standaloneMonthName(control.visibleMonth)
@@ -426,7 +433,7 @@ Style {
Rectangle {
id: topGridLine
- color: gridColor
+ color: __horizontalSeparatorColor
width: parent.width
height: __gridLineWidth
visible: gridVisible
@@ -482,7 +489,7 @@ Style {
anchors.bottom: weekNumbersItem.bottom
width: __gridLineWidth
- color: gridColor
+ color: __verticalSeparatorColor
visible: control.weekNumbersVisible
}
diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml
index 8c17e35a..20fc5a19 100644
--- a/src/controls/Styles/Base/ScrollViewStyle.qml
+++ b/src/controls/Styles/Base/ScrollViewStyle.qml
@@ -266,8 +266,8 @@ Style {
transitions: Transition {
to: "out"
SequentialAnimation {
- PauseAnimation { duration: 450 }
- NumberAnimation { properties: "opacity"; duration: 200 }
+ PauseAnimation { duration: root.__scrollBarFadeDelay }
+ NumberAnimation { properties: "opacity"; duration: root.__scrollBarFadeDuration }
PropertyAction { target: panel; property: "visible"; value: false }
}
}
@@ -392,4 +392,8 @@ Style {
property bool __externalScrollBars: false
/*! \internal */
property int __scrollBarSpacing: 4
+ /*! \internal */
+ property int __scrollBarFadeDelay: 450
+ /*! \internal */
+ property int __scrollBarFadeDuration: 200
}
diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml
index ffd30a58..6c76386f 100644
--- a/src/controls/Styles/Base/SpinBoxStyle.qml
+++ b/src/controls/Styles/Base/SpinBoxStyle.qml
@@ -163,6 +163,8 @@ Style {
implicitHeight: backgroundLoader.implicitHeight
baselineOffset: backgroundLoader.item ? backgroundLoader.item.baselineOffset : 0
+ property font font
+
property color foregroundColor: spinboxStyle.textColor
property color selectionColor: spinboxStyle.selectionColor
property color selectedTextColor: spinboxStyle.selectedTextColor
diff --git a/src/controls/Styles/Base/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml
index ad1d3856..44c6ca72 100644
--- a/src/controls/Styles/Base/TabViewStyle.qml
+++ b/src/controls/Styles/Base/TabViewStyle.qml
@@ -128,6 +128,7 @@ Style {
\row \li readonly property string \b styleData.title \li Tab title text.
\row \li readonly property bool \b styleData.nextSelected \li The next tab is selected.
\row \li readonly property bool \b styleData.previousSelected \li The previous tab is selected.
+ \row \li readonly property bool \b styleData.pressed \li The tab is being pressed. (since QtQuick.Controls.Styles 1.3)
\row \li readonly property bool \b styleData.hovered \li The tab is being hovered.
\row \li readonly property bool \b styleData.enabled \li The tab is enabled. (since QtQuick.Controls.Styles 1.2)
\row \li readonly property bool \b styleData.activeFocus \li The tab button has keyboard focus.
diff --git a/src/controls/Styles/Base/TextAreaStyle.qml b/src/controls/Styles/Base/TextAreaStyle.qml
index 774f5cc6..301ac165 100644
--- a/src/controls/Styles/Base/TextAreaStyle.qml
+++ b/src/controls/Styles/Base/TextAreaStyle.qml
@@ -96,4 +96,38 @@ ScrollViewStyle {
\sa Text::renderType
*/
property int renderType: Text.NativeRendering
+
+ /*! The cursor handle.
+ \since QtQuick.Controls.Styles 1.3
+
+ The parent of the handle is positioned to the top left corner of
+ the cursor position. The interactive area is determined by the
+ geometry of the handle delegate.
+
+ The following read-only properties are available within the scope
+ of the handle delegate:
+ \table
+ \row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
+ \row \li \b {styleData.position} : int \li The character position of the handle.
+ \row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
+ \endtable
+ */
+ property Component cursorHandle
+
+ /*! The selection handle.
+ \since QtQuick.Controls.Styles 1.3
+
+ The parent of the handle is positioned to the top left corner of
+ the first selected character. The interactive area is determined
+ by the geometry of the handle delegate.
+
+ The following read-only properties are available within the scope
+ of the handle delegate:
+ \table
+ \row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
+ \row \li \b {styleData.position} : int \li The character position of the handle.
+ \row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
+ \endtable
+ */
+ property Component selectionHandle
}
diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml
index 4fe0d0a9..f33d4876 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -154,4 +154,38 @@ Style {
anchors.fill: parent
}
}
+
+ /*! The cursor handle.
+ \since QtQuick.Controls.Styles 1.3
+
+ The parent of the handle is positioned to the top left corner of
+ the cursor position. The interactive area is determined by the
+ geometry of the handle delegate.
+
+ The following read-only properties are available within the scope
+ of the handle delegate:
+ \table
+ \row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
+ \row \li \b {styleData.position} : int \li The character position of the handle.
+ \row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
+ \endtable
+ */
+ property Component cursorHandle
+
+ /*! The selection handle.
+ \since QtQuick.Controls.Styles 1.3
+
+ The parent of the handle is positioned to the top left corner of
+ the first selected character. The interactive area is determined
+ by the geometry of the handle delegate.
+
+ The following read-only properties are available within the scope
+ of the handle delegate:
+ \table
+ \row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
+ \row \li \b {styleData.position} : int \li The character position of the handle.
+ \row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
+ \endtable
+ */
+ property Component selectionHandle
}
diff --git a/src/controls/Styles/Desktop/CheckBoxStyle.qml b/src/controls/Styles/Desktop/CheckBoxStyle.qml
index 456e7e4b..4fb7d47a 100644
--- a/src/controls/Styles/Desktop/CheckBoxStyle.qml
+++ b/src/controls/Styles/Desktop/CheckBoxStyle.qml
@@ -59,7 +59,7 @@ Style {
hints: control.styleHints
properties: {"partiallyChecked": (control.checkedState === Qt.PartiallyChecked) }
contentHeight: textitem.implicitHeight
- contentWidth: textitem.implicitWidth + indicatorWidth
+ contentWidth: Math.ceil(textitem.implicitWidth) + 4
property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4)
property bool macStyle: (style === "mac")
diff --git a/src/controls/Styles/Desktop/RadioButtonStyle.qml b/src/controls/Styles/Desktop/RadioButtonStyle.qml
index cf1d4091..a1809ad2 100644
--- a/src/controls/Styles/Desktop/RadioButtonStyle.qml
+++ b/src/controls/Styles/Desktop/RadioButtonStyle.qml
@@ -62,7 +62,7 @@ Style {
hasFocus: control.activeFocus && styleitem.style == "mac"
hints: control.styleHints
contentHeight: textitem.implicitHeight
- contentWidth: textitem.implicitWidth + indicatorWidth
+ contentWidth: Math.ceil(textitem.implicitWidth) + 4
property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4)
property bool macStyle: (style === "mac")
diff --git a/src/controls/Styles/Desktop/SpinBoxStyle.qml b/src/controls/Styles/Desktop/SpinBoxStyle.qml
index 36e84cd4..d7d32916 100644
--- a/src/controls/Styles/Desktop/SpinBoxStyle.qml
+++ b/src/controls/Styles/Desktop/SpinBoxStyle.qml
@@ -63,6 +63,8 @@ Style {
property int horizontalAlignment: Qt.platform.os === "osx" ? Qt.AlignRight : Qt.AlignLeft
property int verticalAlignment: Qt.AlignVCenter
+ property alias font: styleitem.font
+
property color foregroundColor: SystemPaletteSingleton.text(control.enabled)
property color backgroundColor: SystemPaletteSingleton.base(control.enabled)
property color selectionColor: SystemPaletteSingleton.highlight(control.enabled)
diff --git a/src/controls/Switch.qml b/src/controls/Switch.qml
index bafb567c..639610bf 100644
--- a/src/controls/Switch.qml
+++ b/src/controls/Switch.qml
@@ -77,6 +77,14 @@ Control {
property bool checked: false
/*!
+ \qmlproperty bool Switch::pressed
+ \since QtQuick.Controls 1.3
+
+ This property is \c true when the control is pressed.
+ */
+ readonly property alias pressed: internal.pressed
+
+ /*!
This property is \c true if the control takes the focus when it is
pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be
called on the control.
@@ -88,6 +96,13 @@ Control {
*/
property ExclusiveGroup exclusiveGroup: null
+ /*!
+ \since QtQuick.Controls 1.3
+
+ This signal is emitted when the control is clicked.
+ */
+ signal clicked
+
Keys.onPressed: {
if (event.key === Qt.Key_Space && !event.isAutoRepeat)
checked = !checked;
@@ -126,6 +141,8 @@ Control {
checked = (handle.x === max) ? false : true
}
}
+
+ onClicked: root.clicked()
}
onCheckedChanged: {
diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml
index 440606e0..5787e3c4 100644
--- a/src/controls/TabView.qml
+++ b/src/controls/TabView.qml
@@ -81,6 +81,16 @@ FocusScope {
*/
property int tabPosition: Qt.TopEdge
+ /*!
+ \qmlproperty Item TabView::contentItem
+ \since QtQuick.Controls 1.3
+
+ This property holds the content item of the tab view.
+
+ Tabs declared as children of a TabView are automatically parented to the TabView's contentItem.
+ */
+ readonly property alias contentItem: stack
+
/*! \internal */
default property alias data: stack.data
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index 27747968..b0c8882f 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -132,6 +132,14 @@ ScrollView {
*/
property alias cursorPosition: edit.cursorPosition
+ /*!
+ \qmlproperty rect TextArea::cursorRectangle
+ \since QtQuick.Controls 1.3
+
+ The rectangle where the text cursor is rendered within the text area.
+ */
+ readonly property alias cursorRectangle: edit.cursorRectangle
+
/*! \qmlproperty font TextArea::font
The font of the TextArea.
@@ -642,6 +650,20 @@ ScrollView {
*/
property alias textMargin: edit.textMargin
+ /*! \qmlproperty real TextArea::contentWidth
+ \since QtQuick.Controls 1.3
+
+ The width of the text content.
+ */
+ readonly property alias contentWidth: edit.contentWidth
+
+ /*! \qmlproperty real TextArea::contentHeight
+ \since QtQuick.Controls 1.3
+
+ The height of the text content.
+ */
+ readonly property alias contentHeight: edit.contentHeight
+
frameVisible: true
activeFocusOnTab: true
@@ -661,7 +683,7 @@ ScrollView {
Flickable {
id: flickable
- interactive: false
+ interactive: !edit.selectByMouse
anchors.fill: parent
TextEdit {
@@ -717,7 +739,7 @@ ScrollView {
wrapMode: TextEdit.WordWrap
textMargin: 4
- selectByMouse: Qt.platform.os !== "android" // Workaround for QTBUG-36515
+ selectByMouse: !cursorHandle.delegate || !selectionHandle.delegate
readOnly: false
Keys.forwardTo: area
@@ -726,32 +748,139 @@ ScrollView {
KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null
KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null
- // keep textcursor within scroll view
+ property bool blockRecursion: false
+ property bool hasSelection: selectionStart !== selectionEnd
+ readonly property int selectionPosition: selectionStart !== cursorPosition ? selectionStart : selectionEnd
+
+ // force re-evaluation when contentWidth changes => text layout changes => selection moves
+ property rect selectionRectangle: contentWidth ? positionToRectangle(selectionPosition)
+ : positionToRectangle(selectionPosition)
+
+ onSelectionStartChanged: {
+ if (!blockRecursion && selectionHandle.delegate) {
+ blockRecursion = true
+ selectionHandle.position = selectionPosition
+ blockRecursion = false
+ }
+ }
+
onCursorPositionChanged: {
- if (cursorRectangle.y >= flickableItem.contentY + viewport.height - cursorRectangle.height - textMargin) {
+ if (!blockRecursion && cursorHandle.delegate) {
+ blockRecursion = true
+ cursorHandle.position = cursorPosition
+ blockRecursion = false
+ }
+ ensureVisible(cursorRectangle)
+ }
+
+ function ensureVisible(rect) {
+ if (rect.y >= flickableItem.contentY + viewport.height - rect.height - textMargin) {
// moving down
- flickableItem.contentY = cursorRectangle.y - viewport.height + cursorRectangle.height + textMargin
- } else if (cursorRectangle.y < flickableItem.contentY) {
+ flickableItem.contentY = rect.y - viewport.height + rect.height + textMargin
+ } else if (rect.y < flickableItem.contentY) {
// moving up
- flickableItem.contentY = cursorRectangle.y - textMargin
+ flickableItem.contentY = rect.y - textMargin
}
- if (cursorRectangle.x >= flickableItem.contentX + viewport.width - textMargin) {
+ if (rect.x >= flickableItem.contentX + viewport.width - textMargin) {
// moving right
- flickableItem.contentX = cursorRectangle.x - viewport.width + textMargin
- } else if (cursorRectangle.x < flickableItem.contentX) {
+ flickableItem.contentX = rect.x - viewport.width + textMargin
+ } else if (rect.x < flickableItem.contentX) {
// moving left
- flickableItem.contentX = cursorRectangle.x - textMargin
+ flickableItem.contentX = rect.x - textMargin
}
}
+
onLinkActivated: area.linkActivated(link)
onLinkHovered: area.linkHovered(link)
+ function activate() {
+ if (activeFocusOnPress) {
+ forceActiveFocus()
+ if (!readOnly)
+ Qt.inputMethod.show()
+ }
+ }
+
+ function moveHandles(cursor, selection) {
+ blockRecursion = true
+ Qt.inputMethod.commit()
+ cursorPosition = cursor
+ if (selection === -1) {
+ selectWord()
+ selection = selectionStart
+ }
+ selectionHandle.position = selection
+ cursorHandle.position = cursorPosition
+ blockRecursion = false
+ }
+
MouseArea {
- parent: area.viewport
anchors.fill: parent
cursorShape: edit.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
- acceptedButtons: Qt.NoButton
+ acceptedButtons: edit.selectByMouse ? Qt.NoButton : Qt.LeftButton
+ onClicked: {
+ var pos = edit.positionAt(mouse.x, mouse.y)
+ edit.moveHandles(pos, pos)
+ edit.activate()
+ }
+ onPressAndHold: {
+ var pos = edit.positionAt(mouse.x, mouse.y)
+ edit.moveHandles(pos, -1)
+ edit.activate()
+ }
+ }
+
+ TextHandle {
+ id: selectionHandle
+
+ editor: edit
+ control: area
+ z: 1 // above scrollbars
+ parent: __scroller // no clip
+ delegate: __style.selectionHandle
+ maximum: cursorHandle.position - 1
+ x: edit.selectionRectangle.x - flickableItem.contentX
+ y: edit.selectionRectangle.y - flickableItem.contentY
+ visible: pressed || (edit.hasSelection && handleY + handleHeight >= -1 && handleY <= viewport.height + 1
+ && handleX + handleWidth >= -1 && handleX <= viewport.width + 1)
+
+ onPositionChanged: {
+ if (!edit.blockRecursion) {
+ edit.blockRecursion = true
+ edit.select(selectionHandle.position, cursorHandle.position)
+ if (pressed)
+ edit.ensureVisible(edit.selectionRectangle)
+ edit.blockRecursion = false
+ }
+ }
+ }
+
+ TextHandle {
+ id: cursorHandle
+
+ editor: edit
+ control: area
+ z: 1 // above scrollbars
+ parent: __scroller // no clip
+ delegate: __style.cursorHandle
+ minimum: edit.hasSelection ? selectionHandle.position + 1 : -1
+ x: edit.cursorRectangle.x - flickableItem.contentX
+ y: edit.cursorRectangle.y - flickableItem.contentY
+ visible: pressed || ((edit.cursorVisible || edit.hasSelection)
+ && handleY + handleHeight >= -1 && handleY <= viewport.height + 1
+ && handleX + handleWidth >= -1 && handleX <= viewport.width + 1)
+
+ onPositionChanged: {
+ if (!edit.blockRecursion) {
+ edit.blockRecursion = true
+ if (!edit.hasSelection)
+ selectionHandle.position = cursorHandle.position
+ Qt.inputMethod.commit()
+ edit.select(selectionHandle.position, cursorHandle.position)
+ edit.blockRecursion = false
+ }
+ }
}
}
}
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index 32992b73..24f5e5e7 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -129,6 +129,14 @@ Control {
property alias cursorPosition: textInput.cursorPosition
/*!
+ \qmlproperty rect TextField::cursorRectangle
+ \since QtQuick.Controls 1.3
+
+ The rectangle where the text cursor is rendered within the text field.
+ */
+ readonly property alias cursorRectangle: textInput.cursorRectangle
+
+ /*!
\qmlproperty string TextField::displayText
This property holds the text displayed in the TextField.
@@ -564,14 +572,6 @@ Control {
Accessible.role: Accessible.EditableText
Accessible.description: placeholderText
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- hoverEnabled: true
- cursorShape: Qt.IBeamCursor
- onClicked: textfield.forceActiveFocus()
- }
-
Text {
id: placeholderTextComponent
anchors.fill: textInput
@@ -589,7 +589,7 @@ Control {
TextInput {
id: textInput
focus: true
- selectByMouse: Qt.platform.os !== "android" // Workaround for QTBUG-36515
+ selectByMouse: !cursorHandle.delegate || !selectionHandle.delegate
selectionColor: __panel ? __panel.selectionColor : "darkred"
selectedTextColor: __panel ? __panel.selectedTextColor : "white"
@@ -616,5 +616,117 @@ Control {
}
onEditingFinished: textfield.editingFinished()
+
+ property bool blockRecursion: false
+ property bool hasSelection: selectionStart !== selectionEnd
+ readonly property int selectionPosition: selectionStart !== cursorPosition ? selectionStart : selectionEnd
+
+ // force re-evaluation when selection moves:
+ // - cyrsorRectangle changes => content scrolled
+ // - contentWidth changes => text layout changed
+ property rect selectionRectangle: cursorRectangle.x && contentWidth ? positionToRectangle(selectionPosition)
+ : positionToRectangle(selectionPosition)
+
+ onSelectionStartChanged: {
+ if (!blockRecursion && selectionHandle.delegate) {
+ blockRecursion = true
+ selectionHandle.position = selectionPosition
+ blockRecursion = false
+ }
+ }
+
+ onCursorPositionChanged: {
+ if (!blockRecursion && cursorHandle.delegate) {
+ blockRecursion = true
+ cursorHandle.position = cursorPosition
+ blockRecursion = false
+ }
+ }
+
+ function activate() {
+ if (activeFocusOnPress) {
+ forceActiveFocus()
+ if (!readOnly)
+ Qt.inputMethod.show()
+ }
+ }
+
+ function moveHandles(cursor, selection) {
+ blockRecursion = true
+ Qt.inputMethod.commit()
+ cursorPosition = cursor
+ if (selection === -1) {
+ selectWord()
+ selection = selectionStart
+ }
+ selectionHandle.position = selection
+ cursorHandle.position = cursorPosition
+ blockRecursion = false
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.IBeamCursor
+ acceptedButtons: textInput.selectByMouse ? Qt.NoButton : Qt.LeftButton
+ onClicked: {
+ var pos = textInput.positionAt(mouse.x, mouse.y)
+ textInput.moveHandles(pos, pos)
+ textInput.activate()
+ }
+ onPressAndHold: {
+ var pos = textInput.positionAt(mouse.x, mouse.y)
+ textInput.moveHandles(pos, -1)
+ textInput.activate()
+ }
+ }
+
+ TextHandle {
+ id: selectionHandle
+
+ editor: textInput
+ control: textfield
+ delegate: __style.selectionHandle
+ maximum: cursorHandle.position - 1
+ readonly property real selectionX: textInput.selectionRectangle.x
+ x: textInput.x + (pressed ? Math.max(0, selectionX) : selectionX)
+ y: textInput.selectionRectangle.y + textInput.y
+ visible: pressed || (textInput.hasSelection && handleX + handleWidth >= -1 && handleX <= textfield.width + 1)
+
+ onPositionChanged: {
+ if (!textInput.blockRecursion) {
+ textInput.blockRecursion = true
+ textInput.select(selectionHandle.position, cursorHandle.position)
+ if (pressed)
+ textInput.ensureVisible(position)
+ textInput.blockRecursion = false
+ }
+ }
+ }
+
+ TextHandle {
+ id: cursorHandle
+
+ editor: textInput
+ control: textfield
+ delegate: __style.cursorHandle
+ minimum: textInput.hasSelection ? selectionHandle.position + 1 : -1
+ x: textInput.cursorRectangle.x + textInput.x
+ y: textInput.cursorRectangle.y + textInput.y
+ visible: pressed || ((textInput.cursorVisible || textInput.hasSelection)
+ && handleX + handleWidth >= -1 && handleX <= textfield.width + 1)
+
+ onPositionChanged: {
+ if (!textInput.blockRecursion) {
+ textInput.blockRecursion = true
+ if (!textInput.hasSelection)
+ selectionHandle.position = cursorHandle.position
+ Qt.inputMethod.commit()
+ textInput.select(selectionHandle.position, cursorHandle.position)
+ textInput.blockRecursion = false
+ }
+ }
}
}
diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml
index 90f9d4a3..3430ac2a 100644
--- a/src/controls/ToolBar.qml
+++ b/src/controls/ToolBar.qml
@@ -67,6 +67,7 @@ import QtQuick.Controls.Private 1.0
ApplicationWindow {
toolBar: ToolBar {
RowLayout {
+ anchors.fill: parent
ToolButton { ... }
ToolButton { ... }
ToolButton { ... }
@@ -85,8 +86,10 @@ FocusScope {
LayoutMirroring.childrenInherit: true
width: parent ? parent.width : implicitWidth
- implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
- implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight()
+ implicitWidth: container.leftMargin + container.rightMargin
+ + Math.max(container.layoutWidth, __panel ? __panel.implicitWidth : 0)
+ implicitHeight: container.topMargin + container.bottomMargin
+ + Math.max(container.layoutHeight, __panel ? __panel.implicitHeight : 0)
/*! \internal */
property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar)
@@ -95,6 +98,9 @@ FocusScope {
property alias __style: styleLoader.item
/*! \internal */
+ property Item __panel: panelLoader.item
+
+ /*! \internal */
default property alias __content: container.data
/*!
@@ -112,7 +118,7 @@ FocusScope {
data: [
Loader {
- id: loader
+ id: panelLoader
anchors.fill: parent
sourceComponent: styleLoader.item ? styleLoader.item.panel : null
onLoaded: item.z = -1
@@ -139,13 +145,11 @@ FocusScope {
property int rightMargin: __style ? __style.padding.right : 0
property Item layoutItem: container.children.length === 1 ? container.children[0] : null
- function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
- (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
- layoutItem.anchors.rightMargin : 0) :
- loader.item ? loader.item.implicitWidth : 0) }
- function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
- (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
- layoutItem.anchors.bottomMargin : 0) :
- loader.item ? loader.item.implicitHeight : 0) }
+ property real layoutWidth: layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) : 0
+ property real layoutHeight: layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+ layoutItem.anchors.bottomMargin : 0) : 0
}]
}
diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf
index b3219d90..2b456ff9 100644
--- a/src/controls/doc/qtquickcontrols.qdocconf
+++ b/src/controls/doc/qtquickcontrols.qdocconf
@@ -22,7 +22,7 @@ qhp.QtQuickControls.subprojects = qtquickcontrolsqmltypes qtquickcontrolsstyles
qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.title = Controls QML Types
qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.indexTitle = Qt Quick Controls QML Types
-qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.selectors = fake:qmlclass # cannot choose qmltypes from a specific group QTBUG-32985
+qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.selectors = qmlclass # cannot choose qmltypes from a specific group QTBUG-32985
qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.sortPages = true
qhp.QtQuickControls.subprojects.qtquickcontrolsstyles.title = Qt Quick Controls Styles Structure
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index dc7ee0b5..43831769 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -105,7 +105,9 @@ static const struct {
{ "ToolBar", 1, 0 },
{ "ToolButton", 1, 0 },
- { "BusyIndicator", 1, 1 }
+ { "BusyIndicator", 1, 1 },
+
+ { "TextArea", 1, 3 }
};
void QtQuickControlsPlugin::registerTypes(const char *uri)
diff --git a/src/dialogs/DefaultColorDialog.qml b/src/dialogs/DefaultColorDialog.qml
index c2de493c..dc059445 100644
--- a/src/dialogs/DefaultColorDialog.qml
+++ b/src/dialogs/DefaultColorDialog.qml
@@ -136,7 +136,54 @@ AbstractColorDialog {
anchors.centerIn: parent
property real hue: hueSlider.value
- fragmentShader: "
+ fragmentShader: root.window.glslIsCoreProfile ? "#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;
diff --git a/src/dialogs/doc/qtquickdialogs.qdocconf b/src/dialogs/doc/qtquickdialogs.qdocconf
index 47f6d41e..b299cd63 100644
--- a/src/dialogs/doc/qtquickdialogs.qdocconf
+++ b/src/dialogs/doc/qtquickdialogs.qdocconf
@@ -20,7 +20,7 @@ qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSIO
qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs QML Types
-qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = qmlclass
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true
depends = qtqml qtquick qtgui qtwidgets qtdoc
diff --git a/src/layouts/doc/qtquicklayouts.qdocconf b/src/layouts/doc/qtquicklayouts.qdocconf
index 41fcc6a1..753b82c5 100644
--- a/src/layouts/doc/qtquicklayouts.qdocconf
+++ b/src/layouts/doc/qtquicklayouts.qdocconf
@@ -20,7 +20,7 @@ qhp.QtQuickLayouts.customFilters.Qt.filterAttributes = qtquicklayouts $QT_VERSIO
qhp.QtQuickLayouts.subprojects = qtquicklayoutsqmltypes
qhp.QtQuickLayouts.subprojects.qtquicklayoutsqmltypes.title = QML Types
qhp.QtQuickLayouts.subprojects.qtquicklayoutsqmltypes.indexTitle = Qt Quick Layouts QML Types
-qhp.QtQuickLayouts.subprojects.qtquicklayoutsqmltypes.selectors = class fake:qmlclass
+qhp.QtQuickLayouts.subprojects.qtquicklayoutsqmltypes.selectors = class qmlclass
qhp.QtQuickLayouts.subprojects.qtquicklayoutsqmltypes.sortPages = true
depends = qtqml qtquick qtwidgets qtdoc qtquickcontrols