summaryrefslogtreecommitdiff
path: root/examples/svg/svgviewer/svgview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/svg/svgviewer/svgview.cpp')
-rw-r--r--examples/svg/svgviewer/svgview.cpp61
1 files changed, 7 insertions, 54 deletions
diff --git a/examples/svg/svgviewer/svgview.cpp b/examples/svg/svgviewer/svgview.cpp
index 6674f87..4463aa0 100644
--- a/examples/svg/svgviewer/svgview.cpp
+++ b/examples/svg/svgviewer/svgview.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "svgview.h"
#include <QSvgRenderer>
@@ -58,8 +11,8 @@
#include <QPaintEvent>
#include <qmath.h>
-#ifndef QT_NO_OPENGL
-#include <QOpenGLWidget>
+#ifdef USE_OPENGLWIDGETS
+#include <QtOpenGLWidgets/qopenglwidget.h>
#endif
SvgView::SvgView(QWidget *parent)
@@ -106,14 +59,14 @@ bool SvgView::openFile(const QString &fileName)
const bool drawBackground = (m_backgroundItem ? m_backgroundItem->isVisible() : false);
const bool drawOutline = (m_outlineItem ? m_outlineItem->isVisible() : true);
- QScopedPointer<QGraphicsSvgItem> svgItem(new QGraphicsSvgItem(fileName));
+ auto svgItem = std::make_unique<QGraphicsSvgItem>(fileName);
if (!svgItem->renderer()->isValid())
return false;
s->clear();
resetTransform();
- m_svgItem = svgItem.take();
+ m_svgItem = svgItem.release();
m_svgItem->setFlags(QGraphicsItem::ItemClipsToShape);
m_svgItem->setCacheMode(QGraphicsItem::NoCache);
m_svgItem->setZValue(0);
@@ -145,7 +98,7 @@ void SvgView::setRenderer(RendererType type)
m_renderer = type;
if (m_renderer == OpenGL) {
-#ifndef QT_NO_OPENGL
+#ifdef USE_OPENGLWIDGETS
setViewport(new QOpenGLWidget);
#endif
} else {