summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-05-30 16:51:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-31 10:45:23 +0200
commit8beda08087effd684cfcb325855c9f4b47186135 (patch)
tree4d529ea10892e2840110e6fd3527cc8459e0bb5a
parent9490e1161817ad74d5441db79bd8bde5c8c8db91 (diff)
downloadqtquickcontrols-8beda08087effd684cfcb325855c9f4b47186135.tar.gz
Cleaning up some examples and removing clutter
We want to use more layouts in our examples as it is the recommended way to create tool bars etc. Change-Id: Ib3b1e8e907cc5277d522557a19d2c294a7d251b1 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r--examples/quick/controls/gallery/content/Controls.qml8
-rw-r--r--examples/quick/controls/gallery/content/Styles.qml229
-rw-r--r--examples/quick/controls/gallery/main.qml216
-rw-r--r--examples/quick/controls/splitview/main.qml8
-rw-r--r--examples/quick/controls/text/qml/ToolBarSeparator.qml61
-rw-r--r--examples/quick/controls/text/qml/main.qml77
-rw-r--r--examples/quick/controls/text/resources.qrc1
-rw-r--r--examples/quick/controls/text/src/documenthandler.cpp12
-rw-r--r--examples/quick/controls/text/text.pro3
-rw-r--r--src/controls/doc/images/qtquickcontrols-example-gallery.pngbin53632 -> 34070 bytes
10 files changed, 325 insertions, 290 deletions
diff --git a/examples/quick/controls/gallery/content/Controls.qml b/examples/quick/controls/gallery/content/Controls.qml
index 310eee59..c1403da5 100644
--- a/examples/quick/controls/gallery/content/Controls.qml
+++ b/examples/quick/controls/gallery/content/Controls.qml
@@ -180,6 +180,14 @@ Item {
height: parent.height - group1.height - group2.height - 2 * parent.spacing
anchors { right: parent.right }
}
+
+ MouseArea {
+ id: contextMenu
+ parent: area.viewport
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ onPressed: editmenu.popup()
+ }
}
}
}
diff --git a/examples/quick/controls/gallery/content/Styles.qml b/examples/quick/controls/gallery/content/Styles.qml
index 01b2646f..97797f83 100644
--- a/examples/quick/controls/gallery/content/Styles.qml
+++ b/examples/quick/controls/gallery/content/Styles.qml
@@ -45,127 +45,132 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
-import QtQuick.Dialogs 1.0
+import QtQuick.Layouts 1.0
Item {
id: root
width: 300
height: 200
- ColorDialog {
- id: colorDialog
- color: "#afe"
- property color last: "#afe"
- onRejected: color = last
- onVisibleChanged: if (visible) last = color
- }
-
- Column {
- anchors.margins: 20
- anchors.horizontalCenter: parent.horizontalCenter
+ property int columnWidth: 120
+ GridLayout {
+ rowSpacing: 12
+ columnSpacing: 30
anchors.top: parent.top
- spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.margins: 30
- Row {
- spacing: 8
- Button {
- text: "Set color…"
- style: ButtonStyle { }
- onClicked: colorDialog.open()
- }
- Button {
- text: "Push me"
- style: ButtonStyle { }
- }
- Button {
- text: "Push me"
- style: buttonStyle
- }
+ Button {
+ text: "Push me"
+ style: ButtonStyle { }
+ onClicked: colorDialog.open()
+ implicitWidth: columnWidth
}
- Row {
- spacing: 8
- TextField {
- style: TextFieldStyle { }
- }
- TextField {
- style: TextFieldStyle { }
- }
- TextField {
- style: textfieldStyle
- }
+ Button {
+ text: "Push me"
+ style: ButtonStyle { }
+ implicitWidth: columnWidth
+ }
+ Button {
+ text: "Push me"
+ style: buttonStyle
+ implicitWidth: columnWidth
}
- Row {
- spacing: 8
- Slider {
- value: 50
- maximumValue: 100
- width: 100
- style: SliderStyle { }
- }
- Slider {
- value: 50
- maximumValue: 100
- width: 100
- style: SliderStyle { }
- }
- Slider {
- value: 50
- maximumValue: 100
- width: 100
- style: sliderStyle
- }
+ TextField {
+ Layout.row: 1
+ style: TextFieldStyle { }
+ implicitWidth: columnWidth
+ }
+ TextField {
+ style: TextFieldStyle { }
+ implicitWidth: columnWidth
+ }
+ TextField {
+ style: textfieldStyle
+ implicitWidth: columnWidth
}
- Row {
- spacing: 8
- ProgressBar {
- value: 50
- maximumValue: 100
- width: 100
- style: ProgressBarStyle{ }
- }
- ProgressBar {
- value: 50
- maximumValue: 100
- width: 100
- style: ProgressBarStyle{ }
- }
- ProgressBar {
- value: 50
- maximumValue: 100
- width: 100
- style: progressbarStyle
- }
+ Slider {
+ Layout.row: 2
+ value: 50
+ maximumValue: 100
+ implicitWidth: columnWidth
+ style: SliderStyle { }
+ }
+ Slider {
+ value: 50
+ maximumValue: 100
+ implicitWidth: columnWidth
+ style: SliderStyle { }
+ }
+ Slider {
+ value: 50
+ maximumValue: 100
+ implicitWidth: columnWidth
+ style: sliderStyle
}
- Row {
- spacing: 8
- CheckBox {
- text: "CheckBox"
- style: CheckBoxStyle{}
- }
- RadioButton {
- style: RadioButtonStyle{}
- text: "RadioButton"
- }
+ ProgressBar {
+ Layout.row: 3
+ value: 50
+ maximumValue: 100
+ implicitWidth: columnWidth
+ style: ProgressBarStyle{ }
+ }
+ ProgressBar {
+ value: 50
+ maximumValue: 100
+ implicitWidth: columnWidth
+ style: ProgressBarStyle{ }
+ }
+ ProgressBar {
+ value: 50
+ maximumValue: 100
+ implicitWidth: columnWidth
+ style: progressbarStyle
+ }
- ComboBox {
- model: ["Paris", "Oslo", "New York"]
- style: ComboBoxStyle{}
- }
+ CheckBox {
+ text: "CheckBox"
+ style: CheckBoxStyle{}
+ Layout.row: 4
+ implicitWidth: columnWidth
+ }
+ RadioButton {
+ style: RadioButtonStyle{}
+ text: "RadioButton"
+ implicitWidth: columnWidth
}
- Row {
- TabView {
- width: 400
- height: 30
- Tab { title: "One" ; Item {}}
- Tab { title: "Two" ; Item {}}
- Tab { title: "Three" ; Item {}}
- Tab { title: "Four" ; Item {}}
- style: tabViewStyle
- }
+ ComboBox {
+ model: ["Paris", "Oslo", "New York"]
+ style: ComboBoxStyle{}
+ implicitWidth: columnWidth
+ }
+
+ TabView {
+ Layout.row: 5
+ Layout.columnSpan: 3
+ Layout.fillWidth: true
+ implicitHeight: 30
+ Tab { title: "One" ; Item {}}
+ Tab { title: "Two" ; Item {}}
+ Tab { title: "Three" ; Item {}}
+ Tab { title: "Four" ; Item {}}
+ style: TabViewStyle {}
+ }
+
+ TabView {
+ Layout.row: 6
+ Layout.columnSpan: 3
+ Layout.fillWidth: true
+ implicitHeight: 30
+ Tab { title: "One" ; Item {}}
+ Tab { title: "Two" ; Item {}}
+ Tab { title: "Three" ; Item {}}
+ Tab { title: "Four" ; Item {}}
+ style: tabViewStyle
}
}
@@ -174,7 +179,7 @@ Item {
property Component buttonStyle: ButtonStyle {
background: Rectangle {
implicitHeight: 20
- implicitWidth: 100
+ implicitWidth: columnWidth
color: control.pressed ? "darkGray" : "lightGray"
antialiasing: true
border.color: "gray"
@@ -184,7 +189,7 @@ Item {
property Component textfieldStyle: TextFieldStyle {
background: Rectangle {
- implicitWidth: 100
+ implicitWidth: columnWidth
implicitHeight: 20
color: "#f0f0f0"
antialiasing: true
@@ -205,7 +210,7 @@ Item {
groove: Rectangle {
height: 8
- implicitWidth: 100
+ implicitWidth: columnWidth
implicitHeight: 20
antialiasing: true
@@ -217,7 +222,7 @@ Item {
property Component progressbarStyle: ProgressBarStyle {
background: Rectangle {
- implicitWidth: 100
+ implicitWidth: columnWidth
implicitHeight: 20
color: "#f0f0f0"
border.color: "gray"
@@ -225,7 +230,7 @@ Item {
radius: height/2
}
progress: Rectangle {
- implicitWidth: 100
+ implicitWidth: columnWidth
implicitHeight: 20
color: "#c0c0c0"
border.color: "gray"
@@ -246,18 +251,18 @@ Item {
}
border.color: "#898989"
Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" }
-
}
tab: Item {
- implicitWidth: image.sourceSize.width
+ property int totalOverlap: tabOverlap * (control.count - 1)
+ implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width)
implicitHeight: image.sourceSize.height
BorderImage {
id: image
anchors.fill: parent
source: styleData.selected ? "../images/tab_selected.png" : "../images/tab.png"
- border.left: 50
+ border.left: 30
smooth: false
- border.right: 50
+ border.right: 30
}
Text {
text: styleData.title
diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml
index 93502423..86dddbe2 100644
--- a/examples/quick/controls/gallery/main.qml
+++ b/examples/quick/controls/gallery/main.qml
@@ -70,150 +70,112 @@ ApplicationWindow {
onAccepted: imageViewer.open(fileUrl)
}
- toolBar: ToolBar {
- id: toolbar
- RowLayout {
- spacing: 2
- anchors.verticalCenter: parent.verticalCenter
- ToolButton {
- iconSource: "images/window-new.png"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: window1.visible = !window1.visible
- Accessible.name: "New window"
- tooltip: "Toggle visibility of the second window"
- }
- ToolButton {
- action: openAction
- }
- ToolButton {
- iconSource: "images/document-save-as.png"
- anchors.verticalCenter: parent.verticalCenter
- tooltip: "(Pretend to) save as..."
- }
- }
+ Action {
+ id: openAction
+ text: "&Open"
+ shortcut: "Ctrl+O"
+ iconSource: "images/document-open.png"
+ onTriggered: fileDialog.open()
+ tooltip: "open an image"
+ }
- ChildWindow { id: window1 }
+ Action {
+ id: copyAction
+ text: "&Copy"
+ shortcut: "Ctrl+C"
+ iconName: "edit-copy"
+ enabled: (!!activeFocusItem && !!activeFocusItem["copy"])
+ onTriggered: activeFocusItem.copy()
+ }
- Action {
- id: openAction
- text: "&Open"
- shortcut: "Ctrl+O"
- iconSource: "images/document-open.png"
- onTriggered: fileDialog.open()
- tooltip: "open an image"
- }
+ Action {
+ id: cutAction
+ text: "Cu&t"
+ shortcut: "Ctrl+X"
+ iconName: "edit-cut"
+ enabled: (!!activeFocusItem && !!activeFocusItem["cut"])
+ onTriggered: activeFocusItem.cut()
+ }
+
+ Action {
+ id: pasteAction
+ text: "&Paste"
+ shortcut: "Ctrl+V"
+ iconName: "edit-paste"
+ enabled: (!!activeFocusItem && !!activeFocusItem["paste"])
+ onTriggered: activeFocusItem.paste()
+ }
+
+ ExclusiveGroup {
+ id: textFormatGroup
Action {
- id: copyAction
- text: "&Copy"
- shortcut: "Ctrl+C"
- iconName: "edit-copy"
- enabled: (!!activeFocusItem && !!activeFocusItem["copy"])
- onTriggered: activeFocusItem.copy()
+ id: a1
+ text: "Align Left"
+ checkable: true
+ Component.onCompleted: checked = true
}
Action {
- id: cutAction
- text: "Cu&t"
- shortcut: "Ctrl+X"
- iconName: "edit-cut"
- enabled: (!!activeFocusItem && !!activeFocusItem["cut"])
- onTriggered: activeFocusItem.cut()
+ id: a2
+ text: "Center"
+ checkable: true
}
Action {
- id: pasteAction
- text: "&Paste"
- shortcut: "Ctrl+V"
- iconName: "edit-paste"
- enabled: (!!activeFocusItem && !!activeFocusItem["paste"])
- onTriggered: activeFocusItem.paste()
+ id: a3
+ text: "Align Right"
+ checkable: true
}
+ }
- ExclusiveGroup {
- id: textFormatGroup
-
- Action {
- id: a1
- text: "Align Left"
- checkable: true
- Component.onCompleted: checked = true
- }
-
- Action {
- id: a2
- text: "Center"
- checkable: true
- }
-
- Action {
- id: a3
- text: "Align Right"
- checkable: true
- }
- }
+ ChildWindow { id: window1 }
+ Menu {
+ id: editmenu
+ MenuItem { action: cutAction }
+ MenuItem { action: copyAction }
+ MenuItem { action: pasteAction }
+ MenuSeparator {}
Menu {
- id: editmenu
- MenuItem { action: cutAction }
- MenuItem { action: copyAction }
- MenuItem { action: pasteAction }
- MenuSeparator {}
- Menu {
- title: "Text Format"
- MenuItem { action: a1 }
- MenuItem { action: a2 }
- MenuItem { action: a3 }
- MenuSeparator { }
- MenuItem { text: "Allow Hyphenation"; checkable: true }
- MenuSeparator { }
- Menu {
- title: "More Stuff"
- MenuItem { action: cutAction }
- MenuItem { action: copyAction }
- MenuItem { action: pasteAction }
- MenuSeparator { }
- Menu {
- title: "More Stuff"
- MenuItem { action: cutAction }
- MenuItem { action: copyAction }
- MenuItem { action: pasteAction }
- MenuSeparator { }
- Menu {
- title: "More Stuff"
- MenuItem { action: cutAction }
- MenuItem { action: copyAction }
- MenuItem { action: pasteAction }
- MenuSeparator { }
- Menu {
- title: "More Stuff"
- MenuItem { action: cutAction }
- MenuItem { action: copyAction }
- MenuItem { action: pasteAction }
- }
- }
- }
- }
- }
- Menu {
- title: "Font Style"
- MenuItem { text: "Bold"; checkable: true }
- MenuItem { text: "Italic"; checkable: true }
- MenuItem { text: "Underline"; checkable: true }
- }
+ title: "Text Format"
+ MenuItem { action: a1 }
+ MenuItem { action: a2 }
+ MenuItem { action: a3 }
+ MenuSeparator { }
+ MenuItem { text: "Allow Hyphenation"; checkable: true }
}
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.RightButton
- onPressed: editmenu.popup()
+ Menu {
+ title: "Font Style"
+ MenuItem { text: "Bold"; checkable: true }
+ MenuItem { text: "Italic"; checkable: true }
+ MenuItem { text: "Underline"; checkable: true }
}
+ }
- CheckBox {
- id: enabledCheck
- text: "Enabled"
- checked: true
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
+ toolBar: ToolBar {
+ id: toolbar
+ RowLayout {
+ id: toolbarLayout
+ spacing: 0
+ width: parent.width
+ ToolButton {
+ iconSource: "images/window-new.png"
+ onClicked: window1.visible = !window1.visible
+ Accessible.name: "New window"
+ tooltip: "Toggle visibility of the second window"
+ }
+ ToolButton { action: openAction }
+ ToolButton {
+ iconSource: "images/document-save-as.png"
+ tooltip: "(Pretend to) save as..."
+ }
+ Item { Layout.fillWidth: true }
+ CheckBox {
+ id: enabledCheck
+ text: "Enabled"
+ checked: true
+ }
}
}
diff --git a/examples/quick/controls/splitview/main.qml b/examples/quick/controls/splitview/main.qml
index f035e644..4fa8504a 100644
--- a/examples/quick/controls/splitview/main.qml
+++ b/examples/quick/controls/splitview/main.qml
@@ -61,14 +61,6 @@ ApplicationWindow {
color: "lightsteelblue"
}
- Rectangle {
- id: column1
- width: 200
- Layout.minimumWidth: 100
- Layout.maximumWidth: 300
- color: "lightsteelblue"
- }
-
SplitView {
orientation: Qt.Vertical
Layout.fillWidth: true
diff --git a/examples/quick/controls/text/qml/ToolBarSeparator.qml b/examples/quick/controls/text/qml/ToolBarSeparator.qml
new file mode 100644
index 00000000..40a2bc58
--- /dev/null
+++ b/examples/quick/controls/text/qml/ToolBarSeparator.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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.1
+
+Item {
+ width: 8
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.margins: 6
+ Rectangle {
+ width: 1
+ height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#22000000"
+ }
+ Rectangle {
+ width: 1
+ height: parent.height
+ anchors.horizontalCenterOffset: 1
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#33ffffff"
+ }
+}
diff --git a/examples/quick/controls/text/qml/main.qml b/examples/quick/controls/text/qml/main.qml
index dd8b1848..ec6bff7b 100644
--- a/examples/quick/controls/text/qml/main.qml
+++ b/examples/quick/controls/text/qml/main.qml
@@ -42,6 +42,7 @@ import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
+import QtQuick.Window 2.1
import org.qtproject.example 1.0
ApplicationWindow {
@@ -52,6 +53,37 @@ ApplicationWindow {
title: document.documentTitle + " - Text Editor Example"
+ ApplicationWindow {
+ id: aboutBox
+
+ width: 280
+ height: 120
+ title: "About Text"
+
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 8
+ Item {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Label {
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ text: "This is a basic text editor \nwritten with Qt Quick Controls"
+ }
+ }
+ Button {
+ text: "Ok"
+ isDefault: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ onClicked: aboutBox.close()
+ }
+ Keys.onReturnPressed: aboutBox.close()
+ focus: true
+ }
+ }
+
Action {
id: cut
text: "Cut"
@@ -142,12 +174,6 @@ ApplicationWindow {
checkable: true
checked: document.underline
}
- Action {
- id: color
- text: "&Color ..."
- iconSource: "images/textcolor.png"
- iconName: "format-text-color"
- }
FileDialog {
id: file
@@ -185,13 +211,10 @@ ApplicationWindow {
MenuItem { action: alignCenter }
MenuItem { action: alignRight }
MenuItem { action: alignJustify }
- MenuSeparator {}
- MenuItem { action: color }
}
Menu {
title: "&Help"
- MenuItem { text: "About..." }
- MenuItem { text: "About Qt" }
+ MenuItem { text: "About..." ; onTriggered: aboutBox.show() }
}
}
@@ -200,19 +223,23 @@ ApplicationWindow {
width: parent.width
RowLayout {
anchors.fill: parent
- spacing: 1
+ spacing: 0
ToolButton { action: fileOpen }
- Item { width: 4 }
+ ToolBarSeparator {}
+
ToolButton { action: copy }
ToolButton { action: cut }
ToolButton { action: paste }
- Item { width: 4 }
+
+ ToolBarSeparator {}
+
ToolButton { action: bold }
ToolButton { action: italic }
ToolButton { action: underline }
- Item { width: 4 }
+ ToolBarSeparator {}
+
ToolButton { action: alignLeft }
ToolButton { action: alignCenter }
ToolButton { action: alignRight }
@@ -220,28 +247,13 @@ ApplicationWindow {
Item { Layout.fillWidth: true }
}
}
- ToolBar {
- id: secondaryToolBar
- width: parent.width
-
- RowLayout {
- anchors.fill: parent
- anchors.margins: 4
- ComboBox {
- model: document.defaultFontSizes
- onCurrentTextChanged: document.fontSize = currentText
- currentIndex: document.defaultFontSizes.indexOf(document.fontSize + "")
- }
- TextField { id: fontEdit; enabled: false }
- Item { Layout.fillWidth: true }
- }
- }
TextArea {
Accessible.name: "document"
id: textArea
+ frameVisible: false
width: parent.width
- anchors.top: secondaryToolBar.bottom
+ anchors.top: parent.top
anchors.bottom: parent.bottom
text: document.text
textFormat: Qt.RichText
@@ -254,8 +266,5 @@ ApplicationWindow {
cursorPosition: textArea.cursorPosition
selectionStart: textArea.selectionStart
selectionEnd: textArea.selectionEnd
- onCurrentFontChanged: {
- fontEdit.text = currentFont.family
- }
}
}
diff --git a/examples/quick/controls/text/resources.qrc b/examples/quick/controls/text/resources.qrc
index e67fac6a..4d137ff7 100644
--- a/examples/quick/controls/text/resources.qrc
+++ b/examples/quick/controls/text/resources.qrc
@@ -1,6 +1,7 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>qml/main.qml</file>
+ <file>qml/ToolBarSeparator.qml</file>
<file>qml/images/logo32.png</file>
<file>qml/images/editcopy.png</file>
<file>qml/images/editcut.png</file>
diff --git a/examples/quick/controls/text/src/documenthandler.cpp b/examples/quick/controls/text/src/documenthandler.cpp
index 48b6d033..81eb744b 100644
--- a/examples/quick/controls/text/src/documenthandler.cpp
+++ b/examples/quick/controls/text/src/documenthandler.cpp
@@ -166,13 +166,11 @@ void DocumentHandler::mergeFormatOnWordOrSelection(const QTextCharFormat &format
void DocumentHandler::setSelectionStart(int position)
{
m_selectionStart = position;
-// emit selectionStartChanged();
}
void DocumentHandler::setSelectionEnd(int position)
{
m_selectionEnd = position;
-// emit selectionEndChanged();
}
void DocumentHandler::setAlignment(Qt::Alignment a)
@@ -188,10 +186,8 @@ void DocumentHandler::setAlignment(Qt::Alignment a)
Qt::Alignment DocumentHandler::alignment() const
{
-// if (!m_doc || m_doc->isEmpty() || m_cursorPosition < 0)
-// return Qt::AlignLeft;
QTextCursor cursor = textCursor();
- if (cursor.isNull() || cursor.blockNumber() == 0)
+ if (cursor.isNull())
return Qt::AlignLeft;
return textCursor().blockFormat().alignment();
}
@@ -199,7 +195,7 @@ Qt::Alignment DocumentHandler::alignment() const
bool DocumentHandler::bold() const
{
QTextCursor cursor = textCursor();
- if (cursor.isNull() || cursor.blockNumber() == 0)
+ if (cursor.isNull())
return false;
return textCursor().charFormat().fontWeight() == QFont::Bold;
}
@@ -207,7 +203,7 @@ bool DocumentHandler::bold() const
bool DocumentHandler::italic() const
{
QTextCursor cursor = textCursor();
- if (cursor.isNull() || cursor.blockNumber() == 0)
+ if (cursor.isNull())
return false;
return textCursor().charFormat().fontItalic();
}
@@ -215,7 +211,7 @@ bool DocumentHandler::italic() const
bool DocumentHandler::underline() const
{
QTextCursor cursor = textCursor();
- if (cursor.isNull() || cursor.blockNumber() == 0)
+ if (cursor.isNull())
return false;
return textCursor().charFormat().fontUnderline();
}
diff --git a/examples/quick/controls/text/text.pro b/examples/quick/controls/text/text.pro
index ce6d5f33..864ce0bb 100644
--- a/examples/quick/controls/text/text.pro
+++ b/examples/quick/controls/text/text.pro
@@ -7,7 +7,8 @@ qtHaveModule(widgets) {
include(src/src.pri)
OTHER_FILES += \
- qml/main.qml
+ qml/main.qml \
+ qml/ToolBarSeparator.qml
RESOURCES += \
resources.qrc
diff --git a/src/controls/doc/images/qtquickcontrols-example-gallery.png b/src/controls/doc/images/qtquickcontrols-example-gallery.png
index d3b19bb5..a88eab79 100644
--- a/src/controls/doc/images/qtquickcontrols-example-gallery.png
+++ b/src/controls/doc/images/qtquickcontrols-example-gallery.png
Binary files differ