src
gui
include
corbo-gui
collapsable_groupbox.h
Go to the documentation of this file.
1
/*********************************************************************
2
*
3
* Software License Agreement
4
*
5
* Copyright (c) 2020,
6
* TU Dortmund - Institute of Control Theory and Systems Engineering.
7
* All rights reserved.
8
*
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*
14
* This program 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
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21
*
22
* Authors: Christoph Rösmann
23
*********************************************************************/
24
25
#ifndef SRC_GUI_INCLUDE_CORBO_GUI_COLLAPSABLE_GROUPBOX_H_
26
#define SRC_GUI_INCLUDE_CORBO_GUI_COLLAPSABLE_GROUPBOX_H_
27
28
#include <QGroupBox>
29
#include <QToolButton>
30
#include <QVBoxLayout>
31
#include <QWidget>
32
33
namespace
corbo
{
34
namespace
gui {
35
36
// based on http://stackoverflow.com/questions/32476006/how-to-make-an-expandable-collapsable-section-widget-in-qt
37
// but we are using a groupbox instead of a scrollwidget and fixed sizes (otherwise we get problems with nested groups)
38
class
CollapsableGroupBox
:
public
QWidget
39
{
40
Q_OBJECT
41
42
public
:
43
explicit
CollapsableGroupBox
(
const
QString& title, QWidget* parent = 0);
44
45
bool
isCollapsed
() {
return
_collapsed
; }
46
47
QGroupBox*
groupBox
() {
return
_content
; }
48
49
public
slots:
50
void
setCollapsed
(
bool
collapsed);
51
52
protected
:
53
void
createTitle
(
const
QString& title);
54
void
createContentArea
();
55
56
private
:
57
QVBoxLayout*
_layout
;
58
QToolButton*
_button
;
59
QGroupBox*
_content
;
60
61
bool
_collapsed
;
62
};
63
64
}
// namespace gui
65
}
// namespace corbo
66
67
#endif // SRC_GUI_INCLUDE_CORBO_GUI_COLLAPSABLE_GROUPBOX_H_
corbo::gui::CollapsableGroupBox::isCollapsed
bool isCollapsed()
Definition:
collapsable_groupbox.h:45
corbo::gui::CollapsableGroupBox::createContentArea
void createContentArea()
Definition:
collapsable_groupbox.cpp:78
corbo
Definition:
communication/include/corbo-communication/utilities.h:37
corbo::gui::CollapsableGroupBox::groupBox
QGroupBox * groupBox()
Definition:
collapsable_groupbox.h:47
corbo::gui::CollapsableGroupBox::_content
QGroupBox * _content
Definition:
collapsable_groupbox.h:59
corbo::gui::CollapsableGroupBox::setCollapsed
void setCollapsed(bool collapsed)
Definition:
collapsable_groupbox.cpp:90
corbo::gui::CollapsableGroupBox::_button
QToolButton * _button
Definition:
collapsable_groupbox.h:58
corbo::gui::CollapsableGroupBox::createTitle
void createTitle(const QString &title)
Definition:
collapsable_groupbox.cpp:52
corbo::gui::CollapsableGroupBox::_collapsed
bool _collapsed
Definition:
collapsable_groupbox.h:61
corbo::gui::CollapsableGroupBox::_layout
QVBoxLayout * _layout
Definition:
collapsable_groupbox.h:57
corbo::gui::CollapsableGroupBox::CollapsableGroupBox
CollapsableGroupBox(const QString &title, QWidget *parent=0)
Definition:
collapsable_groupbox.cpp:37
corbo::gui::CollapsableGroupBox
Definition:
collapsable_groupbox.h:38
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:06:46