Close popup windows when application state changes

Nobody is telling the popup to close. If it was, that was probably as a
side effect of the Qt::Popup flag on some platforms. Certainly not on
Windows.

We check for the application state as the application may use a popup
to signal the user about some event happening, and we don't want to close
the popup as soon as the user makes the application active again.

Task-number: QTBUG-36474
Change-Id: If41f7bec696105e3c7d8897e9af5fc075c7b8933
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
QtQuick.Dialogs Dialog: implicit geometry fixes

On platforms with in-scene dialogs (such as Android), implicitHeight
was updating too often, not at the optimal time, and not after
being set invisible.  The result was that if you added more buttons
while the dialog was invisible, it did not grow in height if needed.

Task-number: QTBUG-37285

Change-Id: I0b0ad230751361aed89b71b190f12e53d6c73a22
Reviewed-by: Liang Qi <liang.qi@digia.com>
Merge remote-tracking branch 'origin/release' into stable

Change-Id: Ib619455982ebb154ba5344765b11da5c04091409
Button's text should use SystemPalette.buttonText

In themes with inversed colors text and buttonText colors may differ,
and Button as QButton's analog should use the correct one.

Change-Id: I101e0c463faf5f99df0282486aef0d3411b41156
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Clean-up styling improvements for Calendar

This is a fix-up for 4569ed127c290bea8d165e15dc2eca525825c627 :
"verticalAlignment: Text.AlignVCenter" not needed for alread-centered text;
make previousMonth button center-in parent, similarly to nextMonth button;
drop dead code from HoverButton.

Change-Id: Iceb096944d084ecded70611e3da754150a0e098e
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Doc: Document signals (not handlers) under \qmlsignal

Task-number: QTBUG-35846

Change-Id: I358c3427429b669425f0065686da7e202568c84d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Slider: don't prevent stealing until drag threshold is exceeded

If a Slider is placed in a Flickable (or ListView, etc.),
preventStealing means that you cannot flick the flickable by dragging
over the Slider.  It's better to postpone setting that until we
detect whether the user is really attempting to drag the slider,
because we don't want to rule out use cases such as vertical sliders
in a horizontal ListView or vice-versa, so that you drag in
one direction to move the slider and in another direction to flick.
Platform drag threshold is exposed in Settings (from QStyleHints).
(reverts/refines c9665f3e2d1eb12f1cc5a569c20f5d569fafde7f)

Change-Id: I82feda6028f6effa5b26ad575a1933e48e971453
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
ScrollView: flick threshold comes from platform style

QStyleHints::startDragDistance is used as the standard drag or flick
threshold in QtQuick generally.  We should follow suit because it
may depend on platform characteristics such as screen resolution and
sensitivity of the input devices.

Change-Id: Ibbc7b4549351f795c10de792cb8fa3ff9f5ae58d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Doc: Append handler names to \qmlsignal documentation

Change-Id: I5e06bdf03ba1ba8e5fe7669f690420dc9a039129
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
MenuItem: Don't delete owned bound actions

They may be referenced from somewhere else, and
there's no reason not to keep them alive while
the MenuItem is alive.

Task-number: QTBUG-37554
Change-Id: Idaab616c856348c0b7eeb1a2e9fdc5bfc3f8a5fd
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
ComboBox: fix a warning in MenuContentItem

Change-Id: I8428d7e2f768cd7341ecb3efcc52fc2dba1d0ca0
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Add example for indeterminate progress bar animation

While this is not really a bug fix it was not documented
how you could create your own animated progress bar.

Task-number: QTBUG-37434

Change-Id: I5419c2f886c98189207f4e2682e8dda8206677ee
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Do not reduce items size when snapping to pixel grid.

Due to the required snapping to pixel grid, there was a high risk of
reducing the size of an item to become smaller than its minimum size.

With the original way of snapping (simply doing qRound) it didn't
happen very often, but with the last change the problem became more
evident:
If an item that covered the full extent of a
cell was snapped it would *always* shrink. Sometimes it could then
shrink to become smaller than its minimum size.

This was easy to see if the item snapped was a Text element with
eliding enabled, since that meant that the text was elided as soon
as the Text element got resized to smaller than its minimum.

The current solution now is to always snap the x,y coordinates
(with qCeil), but keep the width and height that was calculated
by the layout. This means that snapped items will be shifted slightly
to the right. Due to this they might extend almost a pixel outside their
calculated cell (on the right or bottom sides).

Due to this we also have to adjust the size hint result calculation so
that it will also ceil up to the nearest integer.

The only downside now is that row/column spacings might be less
than specified, but they should not reduce by more than 1 pixel.

Task-number: QTBUG-36235
Change-Id: Idca909f2102a1f7c5cb50d2490c7af39d722ff4f
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Let ApplicationWindows default max size be unbounded.

Previously, the ApplicationWindow  determined its maximum size from
its content items maximum size. This was inconsistent with how QWidgets
normally behaved. The default max size of an ApplicationWindow is now
therefore unbounded.

If the application want the ApplicationWindow to have a maximum width or
height, the application must set up the binding manually. This can be
done with a fixed maximum size or it can be bound to a layout:

contentItem.maximumHeight: grid.Layout.maximumHeight
contentItem.maximumWidth: grid.Layout.maximumWidth

If the grid layout has anchors.margins, those need to be taken into
consideration too, resulting in the following binding:

contentItem.maximumHeight: grid.Layout.maximumHeight +
                           grid.anchors.topMargin +
                           grid.anchors.bottomMargin

Change-Id: Ibac80ba71f12e3eb9e5db8f875ecfa64b1e28b0d
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Try to maintain bindings to checked property in CheckBox

It is currently impossible to keep a binding to the checked property
because any external manipulation of checked will cause it to be
internally overwritten based on the implicitly triggered
checkedStateChanged signal. This adds a protection mechanism similar
to what we already have on the checkedStateChanged signal.

[ChangeLog][QtQuickControls][CheckBox]Fixed a problem incorrectly causing
bindings to the checked state to break.

Task-number: QTBUG-31627
Change-Id: I506fa34561529a414c7b088001f96e8f283edd89
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Set numerical input hint on SpinBox

Since we don't allow you to override the text validator, we guarantee
that the only thing you are allowed to type in a SpinBox are numbers.

[ChangeLog][QtQuickControls][SpinBox] SpinBox now only shows the
numerical keys in onscreen keyboards where possible.

Task-number: QTBUG-37619
Change-Id: If6412d1dc49bf0e602330e90963e8cd990f5d43c
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
StyleItem: Resolve item palette per item type

This queries the platform theme for each type, and sets the right
palette. This should allow us to remove some workarounds we might
have for those cases in desktop style.

Change-Id: Ia5f650b46de5418586bc946d63fd394875e90184
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Warn that use of private types requires both public and private imports

Task-number: QTBUG-37751
Change-Id: I5a91ec1dc4b38e47846e5e72e41902be876cb306
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Doc: Fix some warnings in Qt Quick Controls

Set 'exampledirs' to '../../../examples/quick/controls' instead, so
the files under 'examples/quick/dialogs' are not processed twice.

Also fix a small typo in BusyIndicatorStyle.qml

Change-Id: Id5b3ff144056ab37e4a9e9f52cd1811797c54fb1
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
QtQuick.Dialogs FileDialog: don't go astray into resources on Android

Needed part of the same fix from QTBUG-36006.

Task-number: QTBUG-37741
Change-Id: I3bfe518dfdd6027bdb932c612d01b0c8d1753dad
Reviewed-by: Liang Qi <liang.qi@digia.com>