itom
Loading...
Searching...
No Matches
collapsibleGroupBox.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26
27 This file is a port and modified version of the
28 Common framework (http://www.commontk.org)
29*********************************************************************** */
30
31#ifndef __CollapsibleGroupBox_h
32#define __CollapsibleGroupBox_h
33
34// Qt includes
35#include <QGroupBox>
36
37#include "commonWidgets.h"
38
40
47class ITOMWIDGETS_EXPORT CollapsibleGroupBox : public QGroupBox
48{
49 Q_OBJECT
50 Q_PROPERTY(bool collapsed READ collapsed WRITE setCollapsed)
51
52
55 Q_PROPERTY(int collapsedHeight READ collapsedHeight WRITE setCollapsedHeight)
56
57public:
58 CollapsibleGroupBox(QWidget* parent = 0);
59 CollapsibleGroupBox(const QString& title, QWidget* parent = 0);
60 virtual ~CollapsibleGroupBox();
61
66 inline void setCollapsed(bool collapse);
67
70 inline bool collapsed()const;
71
73 virtual void setCollapsedHeight(int heightInPixels);
74 int collapsedHeight()const;
75
78 virtual bool eventFilter(QObject* child, QEvent* e);
79
81 virtual void setVisible(bool show);
82protected slots:
85 virtual void expand(bool expand);
86
87protected:
88 QScopedPointer<CollapsibleGroupBoxPrivate> d_ptr;
90 virtual void childEvent(QChildEvent*);
91
92#if QT_VERSION < 0x040600
93 virtual void paintEvent(QPaintEvent*);
94 virtual void mousePressEvent(QMouseEvent*);
95 virtual void mouseReleaseEvent(QMouseEvent*);
96#endif
97
98private:
99 Q_DECLARE_PRIVATE(CollapsibleGroupBox);
100 Q_DISABLE_COPY(CollapsibleGroupBox);
101};
102
103//----------------------------------------------------------------------------
104bool CollapsibleGroupBox::collapsed()const
105{
106 return !this->isChecked();
107}
108
109//----------------------------------------------------------------------------
111{
112 this->setChecked(!collapse);
113}
114
115#endif
Definition collapsibleGroupBox.h:48
void setCollapsed(bool collapse)
Definition collapsibleGroupBox.h:110
Definition collapsibleGroupBox.cpp:85