summaryrefslogtreecommitdiffstats
path: root/src/datavisualizationqml/abstractdeclarative.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualizationqml/abstractdeclarative.cpp')
-rw-r--r--src/datavisualizationqml/abstractdeclarative.cpp54
1 files changed, 20 insertions, 34 deletions
diff --git a/src/datavisualizationqml/abstractdeclarative.cpp b/src/datavisualizationqml/abstractdeclarative.cpp
index 81a889a0..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),
@@ -68,6 +43,9 @@ AbstractDeclarative::AbstractDeclarative(QQuickItem *parent) :
// Set contents to false in case we are in qml designer to make component look nice
m_runningInDesigner = QGuiApplication::applicationDisplayName() == QLatin1String("Qml2Puppet");
setFlag(ItemHasContents, !m_runningInDesigner);
+
+ // Accept touchevents
+ setAcceptTouchEvents(true);
}
AbstractDeclarative::~AbstractDeclarative()
@@ -86,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;
@@ -182,6 +163,11 @@ void AbstractDeclarative::clearSelection()
m_controller->clearSelection();
}
+bool AbstractDeclarative::hasSeries(QAbstract3DSeries *series)
+{
+ return m_controller->hasSeries(series);
+}
+
void AbstractDeclarative::setSelectionMode(SelectionFlags mode)
{
int intmode = int(mode);
@@ -442,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);
@@ -579,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);
@@ -661,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));