CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkCollapsibleGroupBox.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkCollapsibleGroupBox_h
22#define __ctkCollapsibleGroupBox_h
23
24// Qt includes
25#include <QGroupBox>
26
27// CTK includes
28#include "ctkWidgetsExport.h"
29class ctkCollapsibleGroupBoxPrivate;
30
37class CTK_WIDGETS_EXPORT ctkCollapsibleGroupBox : public QGroupBox
38{
39 Q_OBJECT
40 Q_PROPERTY(bool collapsed READ collapsed WRITE setCollapsed)
41
42
45 Q_PROPERTY(int collapsedHeight READ collapsedHeight WRITE setCollapsedHeight)
46
47public:
48 ctkCollapsibleGroupBox(QWidget* parent = 0);
49 ctkCollapsibleGroupBox(const QString& title, QWidget* parent = 0);
51
56 inline void setCollapsed(bool collapse);
57
60 inline bool collapsed()const;
61
63 virtual void setCollapsedHeight(int heightInPixels);
64 int collapsedHeight()const;
65
68 virtual bool eventFilter(QObject* child, QEvent* e);
69
71 virtual void setVisible(bool show);
72protected Q_SLOTS:
75 virtual void expand(bool expand);
76
77protected:
78 QScopedPointer<ctkCollapsibleGroupBoxPrivate> d_ptr;
80 virtual void childEvent(QChildEvent*);
81
82#if QT_VERSION < 0x040600
83 virtual void paintEvent(QPaintEvent*);
84 virtual void mousePressEvent(QMouseEvent*);
85 virtual void mouseReleaseEvent(QMouseEvent*);
86#endif
87
88private:
89 Q_DECLARE_PRIVATE(ctkCollapsibleGroupBox);
90 Q_DISABLE_COPY(ctkCollapsibleGroupBox);
91};
92
93//----------------------------------------------------------------------------
95{
96 return !this->isChecked();
97}
98
99//----------------------------------------------------------------------------
101{
102 this->setChecked(!collapse);
103}
104
105#endif
virtual void childEvent(QChildEvent *)
reimplemented for internal reasons
virtual void mouseReleaseEvent(QMouseEvent *)
ctkCollapsibleGroupBox(const QString &title, QWidget *parent=0)
virtual void setVisible(bool show)
Reimplemented for internal reasons.
void setCollapsed(bool collapse)
virtual void setCollapsedHeight(int heightInPixels)
Set the height of the collapsed box. Does not include the title height.
virtual bool eventFilter(QObject *child, QEvent *e)
int collapsedHeight() const
ctkCollapsibleGroupBox(QWidget *parent=0)
virtual ~ctkCollapsibleGroupBox()
virtual void expand(bool expand)
virtual void mousePressEvent(QMouseEvent *)
virtual void paintEvent(QPaintEvent *)
QScopedPointer< ctkCollapsibleGroupBoxPrivate > d_ptr