VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtQSvgView.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 *******************************************************************************/
4 
7 
8 #pragma once
9 
11 /****************************************************************************
12 **
13 ** Copyright (C) 2017 The Qt Company Ltd.
14 ** Contact: https://www.qt.io/licensing/
15 **
16 ** This file is part of the examples of the Qt Toolkit.
17 **
18 ** $QT_BEGIN_LICENSE:BSD$
19 ** Commercial License Usage
20 ** Licensees holding valid commercial Qt licenses may use this file in
21 ** accordance with the commercial license agreement provided with the
22 ** Software or, alternatively, in accordance with the terms contained in
23 ** a written agreement between you and The Qt Company. For licensing terms
24 ** and conditions see https://www.qt.io/terms-conditions. For further
25 ** information use the contact form at https://www.qt.io/contact-us.
26 **
27 ** BSD License Usage
28 ** Alternatively, you may use this file under the terms of the BSD license
29 ** as follows:
30 **
31 ** "Redistribution and use in source and binary forms, with or without
32 ** modification, are permitted provided that the following conditions are
33 ** met:
34 ** * Redistributions of source code must retain the above copyright
35 ** notice, this list of conditions and the following disclaimer.
36 ** * Redistributions in binary form must reproduce the above copyright
37 ** notice, this list of conditions and the following disclaimer in
38 ** the documentation and/or other materials provided with the
39 ** distribution.
40 ** * Neither the name of The Qt Company Ltd nor the names of its
41 ** contributors may be used to endorse or promote products derived
42 ** from this software without specific prior written permission.
43 **
44 **
45 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
56 **
57 ** $QT_END_LICENSE$
58 **
59 ****************************************************************************/
60 
61 #if !defined(Q_MOC_RUN)
63 #endif
64 
65 #include <QGraphicsView>
66 
67 QT_BEGIN_NAMESPACE
68 class QGraphicsSvgItem;
69 class QSvgRenderer;
70 class QWheelEvent;
71 class QPaintEvent;
72 QT_END_NAMESPACE
73 
74 namespace makVrf
75 {
77  {
78  Q_OBJECT
79 
80  public:
81  explicit DtQSvgView(QWidget *parent = nullptr);
82 
83  virtual ~DtQSvgView();
84 
89  virtual void load(const std::string& contents, bool bKeepViewport = false);
90 
92  virtual bool openFile(const QString &fileName);
93 
94  virtual void drawBackground(QPainter *p, const QRectF &rect) override;
95 
96  virtual QSize svgSize() const;
97 
98  virtual qreal zoomFactor() const;
99 
100  public slots:
101  virtual void setViewBackground(bool enable);
102 
103  virtual void zoomIn();
104  virtual void zoomOut();
105  virtual void resetZoom();
106 
107  signals:
108  void zoomChanged();
109 
110  protected:
111  virtual void wheelEvent(QWheelEvent *event) override;
112  virtual void paintEvent(QPaintEvent *event) override;
113 
114  virtual void deleteAndClearSvg();
115 
116  protected:
117  virtual void zoomBy(qreal factor);
118 
119  QSvgRenderer *pMySvgRenderer;
120 
121 
122  QGraphicsSvgItem *m_svgItem;
123  QGraphicsRectItem *m_backgroundItem;
124  };
125 }
126 
Definition: DtQSvgView.h:76
QGraphicsRectItem * m_backgroundItem
Definition: DtQSvgView.h:123
#define DT_DLL_VRFGUICOMMONQT
Definition: vrfGuiCommonQt.h:20
QSvgRenderer * pMySvgRenderer
Definition: DtQSvgView.h:119
QGraphicsSvgItem * m_svgItem
Definition: DtQSvgView.h:122

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)