diff options
Diffstat (limited to 'src/quick/util/qquickglobal.cpp')
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 62 |
1 files changed, 14 insertions, 48 deletions
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 338ab4b5fa..f1aae5c6fa 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -1,50 +1,15 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 BasysKom GmbH. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 BasysKom GmbH. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <QtQuick/private/qquickvaluetypes_p.h> #include <QtQuick/private/qquickapplication_p.h> #include <QtQuick/private/qquickstate_p.h> #include <QtQuick/private/qquickpropertychanges_p.h> #include <QtQuick/private/qquickitemsmodule_p.h> -#include <QtQuick/private/qquickaccessiblefactory_p.h> - +#if QT_CONFIG(accessibility) +# include <QtQuick/private/qquickaccessiblefactory_p.h> +#endif #include <QtGui/QGuiApplication> #include <QtGui/qdesktopservices.h> #include <QtGui/qfontdatabase.h> @@ -59,6 +24,7 @@ #include <QtQml/private/qqmlanybinding_p.h> #include <QtCore/qiterable.h> +#include <QtCore/qpointer.h> #ifdef Q_CC_MSVC // MSVC2010 warns about 'unused variable t', even if it's used in t->~T() @@ -108,7 +74,7 @@ void QQmlQtQuick2DebugStatesDelegate::buildStatesList(bool cleanList, m_allStates.clear(); //only root context has all instances - for (int ii = 0; ii < instances.count(); ++ii) { + for (int ii = 0; ii < instances.size(); ++ii) { buildStatesList(instances.at(ii)); } } @@ -120,7 +86,7 @@ void QQmlQtQuick2DebugStatesDelegate::buildStatesList(QObject *obj) } QObjectList children = obj->children(); - for (int ii = 0; ii < children.count(); ++ii) { + for (int ii = 0; ii < children.size(); ++ii) { buildStatesList(children.at(ii)); } } @@ -135,7 +101,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, typedef QPointer<QQuickState> QuickStatePointer; QObject *object = property.object(); QString propertyName = property.name(); - for (const QuickStatePointer& statePointer : qAsConst(m_allStates)) { + for (const QuickStatePointer& statePointer : std::as_const(m_allStates)) { if (QQuickState *state = statePointer.data()) { // here we assume that the revert list on itself defines the base state if (state->isStateActive() && state->containsPropertyInRevertList(object, propertyName)) { @@ -192,7 +158,7 @@ class QQuickColorProvider : public QQmlColorProvider public: QVariant colorFromString(const QString &s, bool *ok) override { - QColor c(s); + QColor c = QColor::fromString(s); if (c.isValid()) { if (ok) *ok = true; return QVariant(c); @@ -204,7 +170,7 @@ public: unsigned rgbaFromString(const QString &s, bool *ok) override { - QColor c(s); + QColor c = QColor::fromString(s); if (c.isValid()) { if (ok) *ok = true; return c.rgba(); @@ -262,7 +228,7 @@ public: QVariant tint(const QVariant &baseVar, const QVariant &tintVar) override { - QColor tintColor = tintVar.value<QColor>(); + QColor tintColor = tintVar.value<QColor>().toRgb(); int tintAlpha = tintColor.alpha(); if (tintAlpha == 0xFF) { @@ -272,7 +238,7 @@ public: } // tint the base color and return the final color - QColor baseColor = baseVar.value<QColor>(); + QColor baseColor = baseVar.value<QColor>().toRgb(); qreal a = tintColor.alphaF(); qreal inv_a = 1.0 - a; |