OpenStructure
Loading...
Searching...
No Matches
widget.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License as published by the Free
8// Software Foundation; either version 3.0 of the License, or (at your option)
9// any later version.
10// This library is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this library; if not, write to the Free Software Foundation, Inc.,
17// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//------------------------------------------------------------------------------
19#ifndef OST_GUI_WIDGET_HH
20#define OST_GUI_WIDGET_HH
21
22
24
25#include <QWidget>
26#include <QMetaType>
27/*
28 Author: Marco Biasini
29 */
30
31namespace ost { namespace gui {
32
33typedef QList<QAction*> ActionList;
34
40class DLLEXPORT_OST_GUI Widget : public QWidget {
41 Q_OBJECT
42
43public:
44 Widget(QWidget* widget, QWidget* parent=NULL);
45
47 void SetDestroyOnClose(bool flag);
48
51 bool DestroyOnClose() const;
52
55
57 void SetInternalWidget(QWidget* widget);
58
59
60 const QString& GetUniqueID() const
61 {
62 if (unique_id_.size()==0) {
63 unique_id_=this->metaObject()->className();
64 }
65 return unique_id_;
66 }
67
68 void SetUniqueID(const QString& id)
69 {
70 unique_id_=id;
71 }
72
73 virtual bool Restore(const QString& prefix)=0;
74
75 virtual bool Save(const QString& prefix)=0;
76
77private:
78 mutable QString unique_id_;
79 QWidget* internal_;
80 bool destroy_on_close_;
81};
82
83}}
84
86
87#endif
Base class for widgets.
Definition widget.hh:40
virtual bool Save(const QString &prefix)=0
const QString & GetUniqueID() const
Definition widget.hh:60
Widget(QWidget *widget, QWidget *parent=NULL)
virtual ActionList GetActions()
get Widget specific actions
void SetDestroyOnClose(bool flag)
set whether the widget should be destroyed when closed
void SetUniqueID(const QString &id)
Definition widget.hh:68
void SetInternalWidget(QWidget *widget)
virtual bool Restore(const QString &prefix)=0
bool DestroyOnClose() const
whether the widget should be destroyed upon receiving a close event
QWidget * GetInternalWidget()
Q_DECLARE_METATYPE(ost::io::EntityIOHandlerFactoryBaseP)
#define DLLEXPORT_OST_GUI
QList< QAction * > ActionList
Definition widget.hh:33
Definition base.dox:1