LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
43 class ComponentSymbolVariantListModel;
44 
45 namespace editor {
46 
47 /*******************************************************************************
48  * Class ComponentSymbolVariantListWidget
49  ******************************************************************************/
50 
54 class ComponentSymbolVariantListWidget final : public QWidget {
55  Q_OBJECT
56 
57 public:
58  // Constructors / Destructor
59  explicit ComponentSymbolVariantListWidget(QWidget* parent = nullptr) noexcept;
61  const ComponentSymbolVariantListWidget& other) = delete;
63 
64  // Setters
65  void setReferences(
66  UndoStack* undoStack, ComponentSymbolVariantList* list,
67  IF_ComponentSymbolVariantEditorProvider* editorProvider) noexcept;
68 
69  // Operator Overloadings
71  const ComponentSymbolVariantListWidget& rhs) = delete;
72 
73 private: // Methods
74  void btnEditClicked(const QVariant& data) noexcept;
75  void viewDoubleClicked(const QModelIndex& index) noexcept;
76  void editVariant(const Uuid& uuid) noexcept;
77 
78 private: // Data
79  QScopedPointer<ComponentSymbolVariantListModel> mModel;
80  QScopedPointer<EditableTableWidget> mView;
84 };
85 
86 /*******************************************************************************
87  * End of File
88  ******************************************************************************/
89 
90 } // namespace editor
91 } // namespace library
92 } // namespace librepcb
93 
94 #endif // LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTLISTWIDGET_H
IF_ComponentSymbolVariantEditorProvider * mEditorProvider
Definition: componentsymbolvariantlistwidget.h:83
ComponentSymbolVariantListWidget(QWidget *parent=nullptr) noexcept
Definition: componentsymbolvariantlistwidget.cpp:44
UndoStack * mUndoStack
Definition: componentsymbolvariantlistwidget.h:82
void setReferences(UndoStack *undoStack, ComponentSymbolVariantList *list, IF_ComponentSymbolVariantEditorProvider *editorProvider) noexcept
Definition: componentsymbolvariantlistwidget.cpp:96
QScopedPointer< EditableTableWidget > mView
Definition: componentsymbolvariantlistwidget.h:80
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:79
void editVariant(const Uuid &uuid) noexcept
Definition: componentsymbolvariantlistwidget.cpp:130
The ComponentSymbolVariantListWidget class.
Definition: componentsymbolvariantlistwidget.h:54
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:81