LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
componentsymbolvariantitemlisteditorwidget.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_COMPONENTSYMBOLVARIANTITEMLISTEDITORWIDGET_H
21 #define LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTITEMLISTEDITORWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class UndoStack;
37 class EditableTableWidget;
38 class IF_GraphicsLayerProvider;
39 
40 namespace workspace {
41 class Workspace;
42 }
43 
44 namespace library {
45 
46 class LibraryElementCache;
47 class ComponentSymbolVariantItemListModel;
48 
49 namespace editor {
50 
51 /*******************************************************************************
52  * Class ComponentSymbolVariantItemListEditorWidget
53  ******************************************************************************/
54 
58 class ComponentSymbolVariantItemListEditorWidget final : public QWidget {
59  Q_OBJECT
60 
61 public:
62  // Constructors / Destructor
64  QWidget* parent = nullptr) noexcept;
66  const ComponentSymbolVariantItemListEditorWidget& other) = delete;
68 
69  // Setters
70  void setReferences(
71  const workspace::Workspace& ws,
72  const IF_GraphicsLayerProvider& layerProvider,
74  const std::shared_ptr<const LibraryElementCache>& symbolCache,
75  UndoStack* undoStack) noexcept;
76 
77  // Operator Overloadings
79  const ComponentSymbolVariantItemListEditorWidget& rhs) = delete;
80 
81 signals:
82  void edited();
84 
85 private: // Methods
86  void itemListEdited(
87  const ComponentSymbolVariantItemList& list, int index,
88  const std::shared_ptr<const ComponentSymbolVariantItem>& item,
90  void itemEdited(const ComponentSymbolVariantItemList& list, int index,
91  const std::shared_ptr<const ComponentSymbolVariantItem>& item,
92  ComponentSymbolVariantItem::Event event) noexcept;
93  void btnSymbolBrowseClicked(const QVariant& data) noexcept;
94 
95 private: // Data
96  QScopedPointer<ComponentSymbolVariantItemListModel> mModel;
97  QScopedPointer<EditableTableWidget> mView;
100 
101  // Slots
104 };
105 
106 /*******************************************************************************
107  * End of File
108  ******************************************************************************/
109 
110 } // namespace editor
111 } // namespace library
112 } // namespace librepcb
113 
114 #endif // LIBREPCB_LIBRARY_EDITOR_COMPONENTSYMBOLVARIANTITEMLISTEDITORWIDGET_H
ComponentSymbolVariantItemList::OnElementEditedSlot mOnItemEditedSlot
Definition: componentsymbolvariantitemlisteditorwidget.h:103
~ComponentSymbolVariantItemListEditorWidget() noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:99
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:62
Event
Definition: componentsymbolvariantitem.h:63
ComponentSymbolVariantItemListEditorWidget(QWidget *parent=nullptr) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:45
void itemEdited(const ComponentSymbolVariantItemList &list, int index, const std::shared_ptr< const ComponentSymbolVariantItem > &item, ComponentSymbolVariantItem::Event event) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:148
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers...
Definition: graphicslayer.h:227
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
QScopedPointer< EditableTableWidget > mView
Definition: componentsymbolvariantitemlisteditorwidget.h:97
void itemListEdited(const ComponentSymbolVariantItemList &list, int index, const std::shared_ptr< const ComponentSymbolVariantItem > &item, ComponentSymbolVariantItemList::Event event) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:129
void setReferences(const workspace::Workspace &ws, const IF_GraphicsLayerProvider &layerProvider, ComponentSymbolVariantItemList &items, const std::shared_ptr< const LibraryElementCache > &symbolCache, UndoStack *undoStack) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:106
ComponentSymbolVariantItemListEditorWidget & operator=(const ComponentSymbolVariantItemListEditorWidget &rhs)=delete
const IF_GraphicsLayerProvider * mLayerProvider
Definition: componentsymbolvariantitemlisteditorwidget.h:99
The ComponentSymbolVariantItemListEditorWidget class.
Definition: componentsymbolvariantitemlisteditorwidget.h:58
const workspace::Workspace * mWorkspace
Definition: componentsymbolvariantitemlisteditorwidget.h:98
QScopedPointer< ComponentSymbolVariantItemListModel > mModel
Definition: componentsymbolvariantitemlisteditorwidget.h:96
void btnSymbolBrowseClicked(const QVariant &data) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:166
The Slot class is used to receive signals from non-QObject derived classes.
Definition: signalslot.h:36
ComponentSymbolVariantItemList::OnEditedSlot mOnItemListEditedSlot
Definition: componentsymbolvariantitemlisteditorwidget.h:102