summaryrefslogtreecommitdiff
path: root/src/controls/Private
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls/Private')
-rw-r--r--src/controls/Private/AbstractCheckable.qml18
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp12
-rw-r--r--src/controls/Private/qquicktreemodeladaptor.cpp4
3 files changed, 28 insertions, 6 deletions
diff --git a/src/controls/Private/AbstractCheckable.qml b/src/controls/Private/AbstractCheckable.qml
index bca626e0..38b19399 100644
--- a/src/controls/Private/AbstractCheckable.qml
+++ b/src/controls/Private/AbstractCheckable.qml
@@ -37,6 +37,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Private 1.0
+import QtQuick.Window 2.2
/*!
\qmltype AbstractCheckable
@@ -100,6 +101,14 @@ Control {
*/
property string text
+ /*!
+ This property holds the button tooltip.
+
+ \since QtQuick.Controls 1.7
+ */
+ property string tooltip
+ Accessible.description: tooltip
+
/*! \internal */
property var __cycleStatesHandler: cycleRadioButtonStates
@@ -119,10 +128,19 @@ Control {
onPressed: if (activeFocusOnPress) forceActiveFocus();
+ onExited: Tooltip.hideText()
+ onCanceled: Tooltip.hideText()
+
onReleased: {
if (containsMouse && (!exclusiveGroup || !checked))
__cycleStatesHandler();
}
+
+ Timer {
+ interval: 1000
+ running: mouseArea.containsMouse && !pressed && tooltip.length && mouseArea.Window.visibility !== Window.Hidden
+ onTriggered: Tooltip.showText(mouseArea, Qt.point(mouseArea.mouseX, mouseArea.mouseY), tooltip)
+ }
}
/*! \internal */
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index 6f7dc729..9e76cb07 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -86,7 +86,8 @@ bool QQuickControlSettings::hasTouchScreen() const
#if defined(Q_OS_ANDROID)
return true;
#else
- foreach (const QTouchDevice *dev, QTouchDevice::devices())
+ const auto devices = QTouchDevice::devices();
+ for (const QTouchDevice *dev : devices)
if (dev->type() == QTouchDevice::TouchScreen)
return true;
return false;
@@ -146,7 +147,8 @@ static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleN
{
QString path;
bool found = false;
- foreach (const QString &import, engine->importPathList()) {
+ const auto importPathList = engine->importPathList();
+ for (const QString &import : importPathList) {
QDir dir(import + QStringLiteral("/QtQuick/Controls/Styles"));
if (dir.exists(styleName)) {
found = true;
@@ -182,7 +184,8 @@ QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine)
const QString defaultStyle = defaultStyleName();
dir.setPath(relativeStyleImportPath(engine, defaultStyle));
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
- foreach (const QString &styleDirectory, dir.entryList()) {
+ const auto list = dir.entryList();
+ for (const QString &styleDirectory : list) {
findStyle(engine, styleDirectory);
}
@@ -259,7 +262,8 @@ void QQuickControlSettings::findStyle(QQmlEngine *engine, const QString &styleNa
StyleData styleData;
- foreach (const QString &fileName, dir.entryList()) {
+ const auto list = dir.entryList();
+ for (const QString &fileName : list) {
// This assumes that there is only one library in the style directory,
// which should be a safe assumption. If at some point it's determined
// not to be safe, we'll have to resolve the init and path functions
diff --git a/src/controls/Private/qquicktreemodeladaptor.cpp b/src/controls/Private/qquicktreemodeladaptor.cpp
index 666fafc9..c357939a 100644
--- a/src/controls/Private/qquicktreemodeladaptor.cpp
+++ b/src/controls/Private/qquicktreemodeladaptor.cpp
@@ -314,7 +314,7 @@ QItemSelection QQuickTreeModelAdaptor::selectionForRowRange(const QModelIndex &
QItemSelection sel;
sel.reserve(ranges.count());
- foreach (const MIPair &pair, ranges)
+ for (const MIPair &pair : qAsConst(ranges))
sel.append(QItemSelectionRange(pair.first, pair.second));
return sel;
@@ -587,7 +587,7 @@ void QQuickTreeModelAdaptor::modelLayoutChanged(const QList<QPersistentModelInde
emit dataChanged(index(0), index(m_items.count() - 1));
}
- Q_FOREACH (const QPersistentModelIndex &pmi, parents) {
+ for (const QPersistentModelIndex &pmi : parents) {
if (m_expandedItems.contains(pmi)) {
int row = itemIndex(pmi);
if (row != -1) {