HAL
expanding_list_widget.h
Go to the documentation of this file.
1
// MIT License
2
//
3
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7
//
8
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
// of this software and associated documentation files (the "Software"), to deal
10
// in the Software without restriction, including without limitation the rights
11
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
// copies of the Software, and to permit persons to whom the Software is
13
// furnished to do so, subject to the following conditions:
14
//
15
// The above copyright notice and this permission notice shall be included in all
16
// copies or substantial portions of the Software.
17
//
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
// SOFTWARE.
25
26
#pragma once
27
28
#include <QScrollArea>
29
#include <QHash>
30
#include <QMap>
31
#include <QString>
32
#include <QList>
33
34
class
QFrame
;
35
class
QVBoxLayout
;
36
37
namespace
hal
38
{
39
class
ExpandingListButton;
40
class
ExpandingListItem;
41
46
class
ExpandingListGroup
:
public
QList
<ExpandingListItem*>
47
{
48
public
:
49
bool
mCollapsed
;
53
ExpandingListGroup
() :
mCollapsed
(false) {;}
54
60
void
toggleCollapsed
(
ExpandingListButton
* exceptSelected);
61
};
62
73
class
ExpandingListWidget
:
public
QScrollArea
74
{
75
Q_OBJECT
76
77
public
:
78
84
ExpandingListWidget
(
QWidget
*
parent
=
nullptr
);
85
94
void
appendItem
(
ExpandingListButton
* button,
const
QString
& groupName =
QString
());
95
102
void
selectButton
(
ExpandingListButton
* button);
103
107
void
selectFirstItem
();
108
115
void
selectItem
(
int
index);
116
120
void
repolish
();
121
128
bool
hasGroup
(
const
QString
& groupName)
const
;
129
133
void
clearSelected
();
134
135
Q_SIGNALS
:
141
void
buttonSelected
(
ExpandingListButton
* button);
142
143
public
Q_SLOTS
:
144
148
void
handleClicked
();
149
150
private
:
151
QFrame
* mContent;
152
QVBoxLayout
* mContentLayout;
153
QFrame
* mSpacer;
154
155
QMap<QString,ExpandingListItem*>
mItemMap;
156
157
ExpandingListButton
* mSelectedButton;
158
159
int
mItemWidth;
160
int
mOffset;
161
QHash<QString,ExpandingListGroup>
mButtonGroup;
162
};
163
}
hal::ExpandingListButton
One button of the ExpandingListWidget.
Definition:
expanding_list_button.h:45
hal::ExpandingListGroup
A helper class to group related list items (buttons).
Definition:
expanding_list_widget.h:47
hal::ExpandingListGroup::ExpandingListGroup
ExpandingListGroup()
Definition:
expanding_list_widget.h:53
hal::ExpandingListGroup::mCollapsed
bool mCollapsed
Definition:
expanding_list_widget.h:49
hal::ExpandingListGroup::toggleCollapsed
void toggleCollapsed(ExpandingListButton *exceptSelected)
Definition:
expanding_list_widget.cpp:122
hal::ExpandingListWidget
A selection menu with a hierarchic structure.
Definition:
expanding_list_widget.h:74
hal::ExpandingListWidget::selectFirstItem
void selectFirstItem()
Definition:
expanding_list_widget.cpp:76
hal::ExpandingListWidget::selectItem
void selectItem(int index)
hal::ExpandingListWidget::handleClicked
void handleClicked()
Definition:
expanding_list_widget.cpp:102
hal::ExpandingListWidget::selectButton
void selectButton(ExpandingListButton *button)
Definition:
expanding_list_widget.cpp:53
hal::ExpandingListWidget::appendItem
void appendItem(ExpandingListButton *button, const QString &groupName=QString())
Definition:
expanding_list_widget.cpp:31
hal::ExpandingListWidget::buttonSelected
void buttonSelected(ExpandingListButton *button)
hal::ExpandingListWidget::clearSelected
void clearSelected()
Definition:
expanding_list_widget.cpp:46
hal::ExpandingListWidget::hasGroup
bool hasGroup(const QString &groupName) const
Definition:
expanding_list_widget.cpp:117
hal::ExpandingListWidget::repolish
void repolish()
Definition:
expanding_list_widget.cpp:91
hal::ExpandingListWidget::ExpandingListWidget
ExpandingListWidget(QWidget *parent=nullptr)
Definition:
expanding_list_widget.cpp:13
hal
Definition:
parser_liberty.cpp:10
QFrame
QHash
QList
QMap
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::Q_SIGNALS
Q_SIGNALSQ_SIGNALS
QObject::Q_SLOTS
Q_SLOTSQ_SLOTS
QObject::parent
QObject * parent() const const
QScrollArea
QString
QVBoxLayout
QWidget
plugins
gui
include
gui
expanding_list
expanding_list_widget.h
Generated on Fri Feb 14 2025 14:22:41 for HAL by
1.9.1