LibrePCB Developers Documentation
componentsymbolvariantlistwidget.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_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTLISTWIDGET_H
21 #define LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTLISTWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 
38 class UndoStack;
39 class EditableTableWidget;
40 
41 namespace library {
42 namespace editor {
43 
44 class ComponentSymbolVariantListModel;
45 
46 /*******************************************************************************
47  * Class ComponentSymbolVariantListWidget
48  ******************************************************************************/
49 
53 class ComponentSymbolVariantListWidget final : public QWidget {
54  Q_OBJECT
55 
56 public:
57  // Constructors / Destructor
58  explicit ComponentSymbolVariantListWidget(QWidget* parent = nullptr) noexcept;
60  const ComponentSymbolVariantListWidget& other) = delete;
62 
63  // Setters
64  void setReferences(
65  UndoStack* undoStack, ComponentSymbolVariantList* list,
66  IF_ComponentSymbolVariantEditorProvider* editorProvider) noexcept;
67 
68  // Operator Overloadings
70  const ComponentSymbolVariantListWidget& rhs) = delete;
71 
72 private: // Methods
73  void btnEditClicked(const QVariant& data) noexcept;
74  void viewDoubleClicked(const QModelIndex& index) noexcept;
75  void editVariant(const Uuid& uuid) noexcept;
76 
77 private: // Data
78  QScopedPointer<ComponentSymbolVariantListModel> mModel;
79  QScopedPointer<EditableTableWidget> mView;
83 };
84 
85 /*******************************************************************************
86  * End of File
87  ******************************************************************************/
88 
89 } // namespace editor
90 } // namespace library
91 } // namespace librepcb
92 
93 #endif // LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTLISTWIDGET_H
IF_ComponentSymbolVariantEditorProvider * mEditorProvider
Definition: componentsymbolvariantlistwidget.h:82
ComponentSymbolVariantListWidget(QWidget *parent=nullptr) noexcept
Definition: componentsymbolvariantlistwidget.cpp:44
Definition: airwiresbuilder.cpp:32
UndoStack * mUndoStack
Definition: componentsymbolvariantlistwidget.h:81
void setReferences(UndoStack *undoStack, ComponentSymbolVariantList *list, IF_ComponentSymbolVariantEditorProvider *editorProvider) noexcept
Definition: componentsymbolvariantlistwidget.cpp:96
QScopedPointer< EditableTableWidget > mView
Definition: componentsymbolvariantlistwidget.h:79
ComponentSymbolVariantListWidget & operator=(const ComponentSymbolVariantListWidget &rhs)=delete
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
~ComponentSymbolVariantListWidget() noexcept
Definition: componentsymbolvariantlistwidget.cpp:89
void viewDoubleClicked(const QModelIndex &index) noexcept
Definition: componentsymbolvariantlistwidget.cpp:118
The IF_ComponentSymbolVariantEditorProvider interface.
Definition: if_componentsymbolvarianteditorprovider.h:45
QScopedPointer< ComponentSymbolVariantListModel > mModel
Definition: componentsymbolvariantlistwidget.h:78
void editVariant(const Uuid &uuid) noexcept
Definition: componentsymbolvariantlistwidget.cpp:130
The ComponentSymbolVariantListWidget class.
Definition: componentsymbolvariantlistwidget.h:53
void btnEditClicked(const QVariant &data) noexcept
Definition: componentsymbolvariantlistwidget.cpp:110
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
ComponentSymbolVariantList * mSymbolVariantList
Definition: componentsymbolvariantlistwidget.h:80