diff options
Diffstat (limited to 'src/datavisualizationqml/abstractdeclarative.cpp')
-rw-r--r-- | src/datavisualizationqml/abstractdeclarative.cpp | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/src/datavisualizationqml/abstractdeclarative.cpp b/src/datavisualizationqml/abstractdeclarative.cpp index e449c7d5..af19d46f 100644 --- a/src/datavisualizationqml/abstractdeclarative.cpp +++ b/src/datavisualizationqml/abstractdeclarative.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "abstractdeclarative_p.h" #include "declarativetheme_p.h" @@ -34,7 +8,7 @@ #if defined(Q_OS_IOS) #include <QtCore/QTimer> #endif -#if defined(Q_OS_OSX) +#if defined(Q_OS_MACOS) #include <qpa/qplatformnativeinterface.h> #endif @@ -50,6 +24,7 @@ static QHash<AbstractDeclarative *, QQuickWindow *> graphWindowList; AbstractDeclarative::AbstractDeclarative(QQuickItem *parent) : QQuickItem(parent), + AbstractDeclarativeInterface(), m_controller(0), m_contextWindow(0), m_renderMode(RenderIndirect), @@ -89,8 +64,11 @@ AbstractDeclarative::~AbstractDeclarative() void AbstractDeclarative::setRenderingMode(AbstractDeclarative::RenderingMode mode) { - if (mode == m_renderMode) + if (mode == m_renderMode + || mode <= AbstractDeclarative::RenderingMode::RenderDirectToBackground + || mode >= AbstractDeclarative::RenderingMode::RenderIndirect) { return; + } RenderingMode previousMode = m_renderMode; @@ -450,7 +428,7 @@ void AbstractDeclarative::handleWindowChanged(QQuickWindow *window) if (!window) return; -#if defined(Q_OS_OSX) +#if defined(Q_OS_MACOS) bool previousVisibility = window->isVisible(); // Enable touch events for Mac touchpads window->setVisible(true); @@ -587,7 +565,7 @@ void AbstractDeclarative::render() QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); - if (isVisible()) { + if (funcs && isVisible()) { funcs->glDepthMask(GL_TRUE); funcs->glEnable(GL_DEPTH_TEST); funcs->glDepthFunc(GL_LESS); @@ -669,8 +647,8 @@ void AbstractDeclarative::checkWindowList(QQuickWindow *window) } QList<QQuickWindow *> windowList; - - foreach (AbstractDeclarative *graph, graphWindowList.keys()) { + const auto graphs = graphWindowList.keys(); + for (AbstractDeclarative *graph : graphs) { if (graph->m_renderMode == RenderDirectToBackground || graph->m_renderMode == RenderDirectToBackground_NoClear) { windowList.append(graphWindowList.value(graph)); |