LibrePCB Developers Documentation
checkableitemseditorwidget.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_CHECKABLEITEMSEDITORWIDGET_H
21#define LIBREPCB_EDITOR_CHECKABLEITEMSEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29/*******************************************************************************
30 * Namespace / Forward Declarations
31 ******************************************************************************/
32namespace librepcb {
33namespace editor {
34
35/*******************************************************************************
36 * Class CheckableItemsEditorWidget
37 ******************************************************************************/
38
44class CheckableItemsEditorWidget final : public QFrame {
45 Q_OBJECT
46
47public:
49 typedef std::tuple<QVariant, QString, Qt::CheckState> Item;
50 typedef QVector<Item> ItemList;
51
52 // Constructors / Destructor
54 explicit CheckableItemsEditorWidget(QWidget* parent = nullptr) noexcept;
57
58 // General Methods
59 const ItemList& getItems() const noexcept { return mItems; }
60 void setItems(const ItemList& items) noexcept;
61
62 // Operator Overloadings
64 delete;
65
66private: // Methods
67 void updateWidgets() noexcept;
68
69private: // Data
70 QPointer<QVBoxLayout> mLayout;
72};
73
74/*******************************************************************************
75 * End of File
76 ******************************************************************************/
77
78} // namespace editor
79} // namespace librepcb
80
81Q_DECLARE_METATYPE(librepcb::editor::CheckableItemsEditorWidget::Item)
82Q_DECLARE_METATYPE(librepcb::editor::CheckableItemsEditorWidget::ItemList)
83
84#endif
A widget to modify a list of checkable string items.
Definition: checkableitemseditorwidget.h:44
void setItems(const ItemList &items) noexcept
Definition: checkableitemseditorwidget.cpp:60
void updateWidgets() noexcept
Definition: checkableitemseditorwidget.cpp:69
QVector< Item > ItemList
Definition: checkableitemseditorwidget.h:50
std::tuple< QVariant, QString, Qt::CheckState > Item
Key, text, check state.
Definition: checkableitemseditorwidget.h:49
QPointer< QVBoxLayout > mLayout
Definition: checkableitemseditorwidget.h:70
CheckableItemsEditorWidget & operator=(const CheckableItemsEditorWidget &rhs)=delete
const ItemList & getItems() const noexcept
Definition: checkableitemseditorwidget.h:59
ItemList mItems
Definition: checkableitemseditorwidget.h:71
Definition: occmodel.cpp:77