aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-07 17:20:24 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-07 17:24:19 +0200
commita3b706531b98c64137acaebf26756828cd43a2a0 (patch)
treeb04490213d60519b8a0c90f9c166eef862ed185b /src/quicktemplates2
parent2f4a059881dbec289d86abc7456b42d5eec77ceb (diff)
parentc2b7e55af43518ae1898eddf8611ef617149ca8a (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-explicit.qml src/quicktemplates2/qquickmenu.cpp tests/auto/controls/data/tst_buttongroup.qml tests/auto/controls/data/tst_swipedelegate.qml Change-Id: Ib6042a0ad716f557927e7412d17ea8957d06c015
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp2
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp32
-rw-r--r--src/quicktemplates2/qquickcheckdelegate.cpp4
-rw-r--r--src/quicktemplates2/qquickmenu.cpp2
-rw-r--r--src/quicktemplates2/qquickprogressbar.cpp12
-rw-r--r--src/quicktemplates2/qquickradiobutton.cpp26
-rw-r--r--src/quicktemplates2/qquickradiodelegate.cpp18
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp11
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp4
-rw-r--r--src/quicktemplates2/qquickscrollindicator.cpp4
-rw-r--r--src/quicktemplates2/qquickslider.cpp33
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp2
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp17
13 files changed, 113 insertions, 54 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index f2442cb7..ce75a497 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -384,7 +384,7 @@ void QQuickAbstractButton::setCheckable(bool checkable)
one button can be checked at any time; checking another button automatically
unchecks the previously checked one.
- \note The property has no effect on buttons that belong to an ButtonGroup.
+ \note The property has no effect on buttons that belong to a ButtonGroup.
RadioButton and TabButton are auto-exclusive by default.
*/
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 7fb406c1..7f65b8bf 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE
\note By default, an ApplicationWindow is not visible.
- \sa Page, {Container Controls}
+ \sa {Customizing ApplicationWindow}, Page, {Container Controls}
*/
class QQuickApplicationWindowPrivate : public QQuickItemChangeListener
@@ -275,9 +275,15 @@ QQuickApplicationWindow::~QQuickApplicationWindow()
The background item is stacked under the \l {contentItem}{content item},
but above the \l {Window::color}{background color} of the window.
+ The background item is useful for images and gradients, for example,
+ but the \l {Window::}{color} property is preferable for solid colors,
+ as it doesn't need to create an item.
+
\note If the background item has no explicit size specified, it automatically
follows the control's size. In most cases, there is no need to specify
width or height for a background item.
+
+ \sa {Customizing ApplicationWindow}, contentItem, header, footer, overlay
*/
QQuickItem *QQuickApplicationWindow::background() const
{
@@ -408,6 +414,17 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer)
This default property holds the list of all objects declared as children of
the window.
+ The data property allows you to freely mix visual children, resources and
+ other windows in an ApplicationWindow.
+
+ If you assign an Item to the contentData list, it becomes a child of the
+ window's contentItem, so that it appears inside the window. The item's
+ parent will be the window's \l contentItem.
+
+ It should not generally be necessary to refer to the contentData property,
+ as it is the default property for ApplicationWindow and thus all child
+ items are automatically assigned to this property.
+
\sa contentItem
*/
QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
@@ -420,6 +437,11 @@ QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
\readonly
This property holds the window content item.
+
+ The content item is stacked above the \l background item, and under the
+ \l header, \l footer, and \l overlay items.
+
+ \sa background, header, footer, overlay
*/
QQuickItem *QQuickApplicationWindow::contentItem() const
{
@@ -476,6 +498,14 @@ QQuickItem *QQuickApplicationWindow::activeFocusControl() const
\li This property holds a component to use as a visual item that implements
background dimming for modeless popups. It is created for and stacked below
visible dimming popups.
+ \row
+ \li overlay.pressed()
+ \li This signal is emitted when the overlay is pressed by the user while
+ a popup is visible.
+ \row
+ \li overlay.released()
+ \li This signal is emitted when the overlay is released by the user while
+ a modal popup is visible.
\endtable
\sa Popup::modal, Popup::dim
diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp
index 249aaa95..304d2b6c 100644
--- a/src/quicktemplates2/qquickcheckdelegate.cpp
+++ b/src/quicktemplates2/qquickcheckdelegate.cpp
@@ -108,6 +108,10 @@ QQuickCheckDelegate::QQuickCheckDelegate(QQuickItem *parent) :
This property determines whether the check delegate has three states.
+ In the animation below, the first checkdelegate is tri-state:
+
+ \image qtquickcontrols2-checkdelegate-tristate.gif
+
The default is \c false, i.e., the delegate has only two states.
*/
bool QQuickCheckDelegate::isTristate() const
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 80ad5b68..ed2cd7e0 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -415,7 +415,7 @@ QVariant QQuickMenu::contentModel() const
\note Unlike \c contentChildren, \c contentData does include non-visual QML
objects. It is not re-ordered when items are inserted or moved.
- \sa Item::data, Popup::contentChildren
+ \sa Item::data, {Popup::}{contentChildren}
*/
QQmlListProperty<QObject> QQuickMenu::contentData()
{
diff --git a/src/quicktemplates2/qquickprogressbar.cpp b/src/quicktemplates2/qquickprogressbar.cpp
index 9c091ba1..00ecc5c5 100644
--- a/src/quicktemplates2/qquickprogressbar.cpp
+++ b/src/quicktemplates2/qquickprogressbar.cpp
@@ -48,16 +48,11 @@ QT_BEGIN_NAMESPACE
\ingroup qtquickcontrols2-indicators
\brief Indicates the progress of an operation.
+ \image qtquickcontrols2-progressbar.gif
+
ProgressBar indicates the progress of an operation. The value should be updated
regularly. The range is defined by \l from and \l to, which both can contain any value.
- \table
- \row \li \image qtquickcontrols2-progressbar-normal.png
- \li A progress bar in its normal state.
- \row \li \image qtquickcontrols2-progressbar-disabled.png
- \li A progress bar that is disabled.
- \endtable
-
\code
ProgressBar {
value: 0.5
@@ -214,8 +209,7 @@ qreal QQuickProgressBar::visualPosition() const
A progress bar in indeterminate mode displays that an operation is in progress, but it
doesn't show how much progress has been made.
- See below for an example:
- \image qtquickcontrols2-progressbar-indeterminate.png
+ \image qtquickcontrols2-progressbar-indeterminate.gif
*/
bool QQuickProgressBar::isIndeterminate() const
diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp
index 2aafbfbd..a8d11377 100644
--- a/src/quicktemplates2/qquickradiobutton.cpp
+++ b/src/quicktemplates2/qquickradiobutton.cpp
@@ -50,25 +50,27 @@ QT_BEGIN_NAMESPACE
\ingroup qtquickcontrols2-buttons
\brief An option button that can be toggled on or off.
+ \image qtquickcontrols2-radiobutton.gif
+
RadioButton presents an option button that can be toggled on (checked) or
off (unchecked). Radio buttons are typically used to select one option
from a set of options.
- \table
- \row \li \image qtquickcontrols2-radiobutton-normal.png
- \li A radio button in its normal state.
- \row \li \image qtquickcontrols2-radiobutton-checked.png
- \li A radio button that is checked.
- \row \li \image qtquickcontrols2-radiobutton-focused.png
- \li A radio button that has active focus.
- \row \li \image qtquickcontrols2-radiobutton-disabled.png
- \li A radio button that is disabled.
- \endtable
+ RadioButton inherits its API from \l AbstractButton. For instance,
+ you can set \l {AbstractButton::text}{text} and react to
+ \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
+ The state of the radio button can be set with the
+ \l {AbstractButton::}{checked} property.
Radio buttons are \l {AbstractButton::autoExclusive}{auto-exclusive}
by default. Only one button can be checked at any time amongst radio
buttons that belong to the same parent item; checking another button
- automatically unchecks the previously checked one.
+ automatically unchecks the previously checked one. For radio buttons
+ that do not share a common parent, ButtonGroup can be used to manage
+ exclusivity.
+
+ \l RadioDelegate is similar to RadioButton, except that it is typically
+ used in views.
\code
ColumnLayout {
@@ -85,7 +87,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- \sa ButtonGroup, {Customizing RadioButton}, {Button Controls}
+ \sa ButtonGroup, {Customizing RadioButton}, {Button Controls}, RadioDelegate
*/
QQuickRadioButton::QQuickRadioButton(QQuickItem *parent) :
diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp
index 01a27cc9..bf3557e8 100644
--- a/src/quicktemplates2/qquickradiodelegate.cpp
+++ b/src/quicktemplates2/qquickradiodelegate.cpp
@@ -56,9 +56,23 @@ QT_BEGIN_NAMESPACE
off (unchecked). Radio delegates are typically used to select one option
from a set of options.
- The state of the radio delegate can be set with the
+ RadioDelegate inherits its API from \l ItemDelegate, which is inherited
+ from AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton
+ API. The state of the radio delegate can be set with the
\l {AbstractButton::}{checked} property.
+ Radio delegates are \l {AbstractButton::autoExclusive}{auto-exclusive}
+ by default. Only one delegate can be checked at any time amongst radio
+ delegates that belong to the same parent item; checking another delegate
+ automatically unchecks the previously checked one. For radio delegates
+ that do not share a common parent, ButtonGroup can be used to manage
+ exclusivity.
+
+ \l RadioButton is similar to RadioDelegate, except that it is typically
+ not used in views, but rather when there are only a few options, and often
+ with the requirement that each button is uniquely identifiable.
+
\code
ButtonGroup {
id: buttonGroup
@@ -74,7 +88,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- \sa {Customizing RadioDelegate}, {Delegate Controls}
+ \sa {Customizing RadioDelegate}, {Delegate Controls}, RadioButton
*/
QQuickRadioDelegate::QQuickRadioDelegate(QQuickItem *parent) :
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 34654fe1..a4862fa6 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -56,17 +56,6 @@ QT_BEGIN_NAMESPACE
RangeSlider is used to select a range specified by two values, by sliding
each handle along a track.
- \table
- \row \li \image qtquickcontrols2-rangeslider-normal.png
- \li A range slider in its normal state.
- \row \li \image qtquickcontrols2-rangeslider-first-handle-focused.png
- \li A range slider whose first handle has active focus.
- \row \li \image qtquickcontrols2-rangeslider-second-handle-focused.png
- \li A range slider whose second handle has active focus.
- \row \li \image qtquickcontrols2-rangeslider-disabled.png
- \li A range slider that is disabled.
- \endtable
-
\code
RangeSlider {
first.value: 0.25
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 5f26814d..d81b1bd5 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE
\ingroup qtquickcontrols2-indicators
\brief An interactive scroll bar control.
+ \image qtquickcontrols2-scrollbar.gif
+
ScrollBar is an interactive bar that can be used to scroll to a specific
position. A scroll bar can be either \l vertical or \l horizontal, and can
be attached to any \l Flickable, such as \l ListView and \l GridView.
- \image qtquickcontrols2-scrollbar.png
-
\code
Flickable {
// ...
diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp
index 351f3113..b1a3e4ec 100644
--- a/src/quicktemplates2/qquickscrollindicator.cpp
+++ b/src/quicktemplates2/qquickscrollindicator.cpp
@@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE
\ingroup qtquickcontrols2-indicators
\brief A non-interactive scroll indicator control.
+ \image qtquickcontrols2-scrollindicator.gif
+
ScrollIndicator is a non-interactive indicator that indicates the current scroll
position. A scroll indicator can be either \l vertical or \l horizontal, and can
be attached to any \l Flickable, such as \l ListView and \l GridView.
- \image qtquickcontrols2-scrollindicator.png
-
\code
Flickable {
// ...
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 43754260..63fc50ac 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -54,21 +54,24 @@ QT_BEGIN_NAMESPACE
Slider is used to select a value by sliding a handle along a track.
- \table
- \row \li \image qtquickcontrols2-slider-normal.png
- \li A slider in its normal state.
- \row \li \image qtquickcontrols2-slider-focused.png
- \li A slider that has active focus.
- \row \li \image qtquickcontrols2-slider-disabled.png
- \li A slider that is disabled.
- \endtable
+ In the example below, custom \l from, \l value, and \l to values are set:
\code
Slider {
- value: 0.5
+ from: 1
+ value: 25
+ to: 100
}
\endcode
+ The \l position property is defined as a percentage of the control's size,
+ scaled within the range \c {0.0 - 1.0}. The \l visualPosition property is
+ the same, except that it is reversed in a
+ \l {Right-to-left User Interfaces}{right-to-left} application. The
+ visualPosition is useful for positioning the handle when styling Slider.
+ In the example above, \l visualPosition will be \c 0.24 in a left-to-right
+ application, and \c 0.76 in a right-to-left application.
+
\sa {Customizing Slider}, {Input Controls}
*/
@@ -322,6 +325,18 @@ void QQuickSlider::setStepSize(qreal step)
\value Slider.SnapAlways The slider snaps while the handle is dragged.
\value Slider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
+ In the following table, the various modes are illustrated with animations.
+ The movement of the mouse cursor and the \l stepSize (\c 0.2) are identical
+ in each animation.
+
+ \table
+ \header
+ \row \li \b Value \li \b Example
+ \row \li \c Slider.NoSnap \li \image qtquickcontrols2-slider-nosnap.gif
+ \row \li \c Slider.SnapAlways \li \image qtquickcontrols2-slider-snapalways.gif
+ \row \li \c Slider.SnapOnRelease \li \image qtquickcontrols2-slider-snaponrelease.gif
+ \endtable
+
\sa stepSize
*/
QQuickSlider::SnapMode QQuickSlider::snapMode() const
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 50eb7584..4bbcc0a5 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -640,7 +640,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
const QPointF mappedEventPos = item->mapToItem(q, event->pos());
const qreal distance = (mappedEventPos - pressPoint).x();
if (!q->keepMouseGrab()) {
- // Taken from QQuickDrawer::handleMouseMoveEvent; see comments there.
+ // Taken from QQuickDrawerPrivate::grabMouse; see comments there.
int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
const bool overThreshold = QQuickWindowPrivate::dragOverThreshold(distance, Qt::XAxis, event, threshold);
if (window && overThreshold) {
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 6d7a505a..ddcf7b12 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -60,13 +60,24 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-tabbar.qml 1
- \section2 Flickable Tabs
+ \section2 Resizing Tabs
By default, TabBar resizes its buttons to fit the width of the control.
The available space is distributed equally to each button. The default
resizing behavior can be overridden by setting an explicit width for the
- buttons. If the total width of the buttons exceeds the available width
- of the tab bar, it automatically becomes flickable.
+ buttons.
+
+ The following example illustrates how to keep each tab button at their
+ implicit size instead of being resized to fit the tabbar:
+
+ \borderedimage qtquickcontrols2-tabbar-explicit.png
+
+ \snippet qtquickcontrols2-tabbar-explicit.qml 1
+
+ \section2 Flickable Tabs
+
+ If the total width of the buttons exceeds the available width of the tab bar,
+ it automatically becomes flickable.
\image qtquickcontrols2-tabbar-flickable.png