Make text selection handles behave in a Flickable

Prevent stealing but not before the drag threshold has been passed.
This makes it possible to flick over the handles, but the press won't
get easily stolen by a Flickable after moving the handles. The same
technique is used in Slider.

Change-Id: I8eac1bf84ada8bb2334f5ed3985f14a520ecc3c5
Reviewed-by: Liang Qi <liang.qi@digia.com>
Add scollBarPolicy properties to scrollview

This adds horizontal and vertical scrollbar policies allowing one to
pernamently show or hide the scrollbars like in QAbstractScrollArea.

Change-Id: I4989dbf2225ab34741b5a2811d7c6ff52880e0c3
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
TextArea: let style specify the default text margin

The hard coded 4px margin is unsuitable especially on High DPI
devices. For example on Nexus 5 it should be 36px, so let the
Android style specify a suitable value.

Change-Id: I31287d2e78ae822b8bd63ea19674c85b08975426
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Text handles: fix input method commits

Change-Id: I1fa2240915b114c6b46360233fcea2b6cee86cd7
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Updated the example so that it adapts to the orientation change

The example was using a Row type to present the visual items, which is
changed to Flow type now, so that the items are rearranged based on the
orientation change on a Mobile device.

Task-number: QTBUG-37203
Change-Id: I990f77a87c409b623a7fe4495d74206a1ca2e1c7
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
ComboBox: respect style padding for the editor

Get rid of the hard coded 8px left margin and use whatever value
the style supplies (and is already used for the label). This allows
the Android style to provide a sensible value for High DPI screens.

The new value for the left margin is 6px in Base and Desktop styles.
It looks slightly better, but still not pixel perfect. Notice that
the text label of editable and non-editable ComboBoxes are not
perfectly aligned in native Windows and OS X ComboBoxes either.

Change-Id: I9a66c3a26fcd9ef1653b355e831277a7b6cbe72f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Fix TextHandle min/max position handling

When not explicitly specified, the maximum is the length of the editor
content, not minus one (cursor can be moved "past" the last character).

Furthermore, due to binding evaluation orders, the minimum/maximum
properties might be temporarily pointing outside the range so we must
validate them to avoid clients (TextField/TextArea) having to do that.

Change-Id: I1faddd1e7ac4f12d7a802484ceb8eea500ad8bfc
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
QtQuick.Dialogs: check for inheriting from QApplication

Widget-based dialogs are allowed if the application is a
QApplication, but subclassing is OK too.

(cherry-picked from qtdeclarative 76952046ceccf2cd176a3452bc908cac769f90d9)
Task-number: QTBUG-35769
Change-Id: I0b74c870488c157913a68e1a30744cd46ae82cee
Reviewed-by: Liang Qi <liang.qi@digia.com>
Merge remote-tracking branch 'origin/5.3' into dev

Change-Id: Iac8c62211c34b36394812d9afedd362a62ba6cef
MenuStyle: Add pressed property to style data object

[ChangeLog][Styling] Add pressed 'property' for MenuItem styling
in styleData object

Task-number: QTBUG-40178
Change-Id: Id5c2af529ed67981415fb055ce83e2c528da525a
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
OS X: fix positioning of non-native menu popups

Change-Id: Iafc7f3a1a41093628e3cba8dd2a7781c2b82b021
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
MenuStyle: fix separator height

Let the delegate choose separator height instead of forcing a height
calculated based on the font size, and check styleData.type instead of
styleData.isSeparator that doesn't exist.

Change-Id: Ia395a27ea86087f772606a252adf7565868ceac9
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
TableView: fix styleData.pressed for filled rows

Change-Id: I42b6fd74fc9a51ab7fbb490ea64fb59df3164c5d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
fix ColorDialog rendering on non-windowing platforms

Need to check the content Item's window rather than the Dialog's window.

Change-Id: I56dbaf163212f1deb68f6b9a984194ab1fbc3b98
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
QQuickMenu: center menu when mouse not present

On touch platforms, QCursor::pos() will return the last
touch synthesized to a mouse pos. Since this will only
happen when the user taps on a control that does not
handle the touch, the position you get can easily be
very old. And in many cases, a mouse pos has never been
synthesized at all, and the position you get is inf.

As a quick fix, this patch checks if the mouse position is
invalid, and center the menu.

For a long term fix we need to find a way to expose touch events in
QGuiApplication, and write logic that determines when to use
touch and when to use mouse to position the menu, and if using touch,
which touch point should be used.

Change-Id: Ic4d2dd78372efcd0c2362204492e76f44ff0a49a
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
QQuickMenu: dismiss platform menu, not only QQuickMenuPopupWindow

This patch will fill in the missing code path that tells a native
platform menu to dismiss when requested.

Change-Id: I2625fddd0a735ca9ec7fabaf783921a1f99caa1d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Doc: Use \value command for documenting flags for QML properties

Replace the table structure with \value commands for documenting
acceptable values for Dialog::standardButtons and
MessageDialog::standardButtons properties, and remove the
unnecessary \enum definitions.

Task-number: QTBUG-35019
Change-Id: Ifcb9ae8b2fbe6859fae324d855a395e4d1d224c1
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Introduce ApplicationWindowStyle

Change-Id: If96bfc8185883ff523ca4242f8ab04b5fccb8999
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
QQuickMenu: add enum MenuType that reflects QPlatformMenu::MenuType

On mobile platforms several different popup menu types exist.
E.g on iOS, you have a special popup just for selecting text.
A recent patch added to QtBase added a new enum to QPlatformMenu
that lets UI controls select/hint which one to use. This patch
adds the same enum to QQuickMenu so that we can control this
from Controls as well.

Change-Id: Ibf4bdc84577b5a6527021b1cb15578b56bb4a92e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Fix ApplicationWindow state / content size

QML Window is not a plain QQuickWindow, but QQuickWindowQmlImpl that
does delayed visibility handling and shows the window in appropriate
state. Thus, ApplicationWindow cannot inherit QQuickWindow or it would
lose all that magic.

QQuickApplicationWindow was added in order for ApplicationWindowStyle
to be able to know whether a custom window color had been set. This
change gets rid of the QQuickWindow subclass and simply compares the
window color to white, which is the default fill color of QQuickWindow.

Change-Id: Ibd95ef0717c2db51246c6a71585e9286e61cef0b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>