Seamly2D
Code documentation
vwidgetproperty_p.h
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vwidgetproperty_p.h
4  ** @author hedgeware <internal(at)hedgeware.net>
5  ** @date
6  **
7  ** @brief
8  ** @copyright
9  ** All rights reserved. This program and the accompanying materials
10  ** are made available under the terms of the GNU Lesser General Public License
11  ** (LGPL) version 2.1 which accompanies this distribution, and is available at
12  ** http://www.gnu.org/licenses/lgpl-2.1.html
13  **
14  ** This library is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  ** Lesser General Public License for more details.
18  **
19  *************************************************************************/
20 
21 #ifndef VWIDGETPROPERTY_P_H
22 #define VWIDGETPROPERTY_P_H
23 
24 // ONLY INCLUDE THIS IN .CPP FILES
25 
26 #include "vproperty_p.h"
27 #include "../vmisc/diagnostic.h"
28 
29 #include <QPointer>
30 #include <QWidget>
31 
32 namespace VPE
33 {
34 
35 QT_WARNING_PUSH
36 QT_WARNING_DISABLE_CLANG("-Wweak-vtables")
37 
39 {
40 public:
41  //! The widget to show
42  QPointer<QWidget> Widget;
43 
44  //! Constructor passing name and type
45  VWidgetPropertyPrivate(const QString& name, QVariant::Type type, QWidget* widget = nullptr)
46  : VPropertyPrivate(name, type), Widget(widget) {}
47 
48  //! Constructor
50  : VPropertyPrivate(), Widget(nullptr) {}
51 
52  //! Destructor
53  virtual ~VWidgetPropertyPrivate() Q_DECL_OVERRIDE
54  {
55  if (Widget)
56  {
57  Widget->deleteLater();
58  }
59  }
60 };
61 
63 
64 }
65 
66 #endif // VWIDGETPROPERTY_P_H
virtual ~VWidgetPropertyPrivate() Q_DECL_OVERRIDE
Destructor.
VWidgetPropertyPrivate(const QString &name, QVariant::Type type, QWidget *widget=nullptr)
Constructor passing name and type.
QPointer< QWidget > Widget
The widget to show.