summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/Private/AbstractCheckable.qml18
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp12
-rw-r--r--src/controls/Private/qquicktreemodeladaptor.cpp4
-rw-r--r--src/controls/Styles/Android/qquickandroid9patch.cpp2
-rw-r--r--src/controls/qquickmenu.cpp3
-rw-r--r--src/controls/qquickmenubar.cpp4
-rw-r--r--src/controls/qquickmenuitemcontainer_p.h2
7 files changed, 34 insertions, 11 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) {
diff --git a/src/controls/Styles/Android/qquickandroid9patch.cpp b/src/controls/Styles/Android/qquickandroid9patch.cpp
index e85e2f29..d4d7172a 100644
--- a/src/controls/Styles/Android/qquickandroid9patch.cpp
+++ b/src/controls/Styles/Android/qquickandroid9patch.cpp
@@ -152,7 +152,7 @@ void QQuickAndroid9PatchDivs::fill(const QVariantList &divs, qreal size)
data.reserve(divs.size() + 1);
}
- foreach (const QVariant &div, divs)
+ for (const QVariant &div : divs)
data.append(div.toReal());
data.append(size);
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp
index 6ae20ff1..d0f5524f 100644
--- a/src/controls/qquickmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -815,7 +815,8 @@ void QQuickMenu1::append_menuItems(QQuickMenuItems *list, QObject *o)
menu->m_containers.insert(o, menuItemContainer);
menuItemContainer->setParentMenu(menu);
++menu->m_containersCount;
- foreach (QObject *child, o->children()) {
+ const auto children = o->children();
+ for (QObject *child : children) {
if (QQuickMenuBase *item = qobject_cast<QQuickMenuBase *>(child)) {
menuItemContainer->insertItem(-1, item);
menu->setupMenuItem(item);
diff --git a/src/controls/qquickmenubar.cpp b/src/controls/qquickmenubar.cpp
index b795cd98..800105ca 100644
--- a/src/controls/qquickmenubar.cpp
+++ b/src/controls/qquickmenubar.cpp
@@ -101,13 +101,13 @@ void QQuickMenuBar1::setNativeNoNotify(bool native)
m_platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
if (m_platformMenuBar) {
m_platformMenuBar->handleReparent(m_parentWindow);
- foreach (QQuickMenu1 *menu, m_menus)
+ for (QQuickMenu1 *menu : qAsConst(m_menus))
m_platformMenuBar->insertMenu(menu->platformMenu(), 0 /* append */);
}
}
} else {
if (m_platformMenuBar) {
- foreach (QQuickMenu1 *menu, m_menus)
+ for (QQuickMenu1 *menu : qAsConst(m_menus))
m_platformMenuBar->removeMenu(menu->platformMenu());
}
delete m_platformMenuBar;
diff --git a/src/controls/qquickmenuitemcontainer_p.h b/src/controls/qquickmenuitemcontainer_p.h
index fe58bf92..c34f2eb3 100644
--- a/src/controls/qquickmenuitemcontainer_p.h
+++ b/src/controls/qquickmenuitemcontainer_p.h
@@ -59,7 +59,7 @@ public:
void setParentMenu(QQuickMenu1 *parentMenu)
{
QQuickMenuBase::setParentMenu(parentMenu);
- Q_FOREACH (QQuickMenuBase *item, m_menuItems)
+ for (QQuickMenuBase *item : qAsConst(m_menuItems))
item->setParentMenu(parentMenu);
}