LibrePCB Developers Documentation
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_EDITOR_COMPONENTSYMBOLVARIANTITEMLISTEDITORWIDGET_H
21#define LIBREPCB_EDITOR_COMPONENTSYMBOLVARIANTITEMLISTEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class Workspace;
37
38namespace editor {
39
40class ComponentSymbolVariantItemListModel;
41class EditableTableWidget;
42class IF_GraphicsLayerProvider;
43class LibraryElementCache;
44class UndoStack;
45
46/*******************************************************************************
47 * Class ComponentSymbolVariantItemListEditorWidget
48 ******************************************************************************/
49
53class ComponentSymbolVariantItemListEditorWidget final : public QWidget {
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
59 QWidget* parent = nullptr) noexcept;
61 const ComponentSymbolVariantItemListEditorWidget& other) = delete;
63
64 // Setters
65 void setReadOnly(bool readOnly) noexcept;
66 void setReferences(
67 const Workspace& ws, const IF_GraphicsLayerProvider& layerProvider,
69 const std::shared_ptr<const LibraryElementCache>& symbolCache,
70 UndoStack* undoStack) noexcept;
71 void resetReferences() noexcept;
72
73 // Operator Overloadings
76
77signals:
78 void edited();
81
82private: // Methods
83 void itemListEdited(
84 const ComponentSymbolVariantItemList& list, int index,
85 const std::shared_ptr<const ComponentSymbolVariantItem>& item,
86 ComponentSymbolVariantItemList::Event event) noexcept;
87 void itemEdited(const ComponentSymbolVariantItemList& list, int index,
88 const std::shared_ptr<const ComponentSymbolVariantItem>& item,
89 ComponentSymbolVariantItem::Event event) noexcept;
90 void btnSymbolBrowseClicked(const QPersistentModelIndex& itemIndex) noexcept;
91
92private: // Data
94 QScopedPointer<EditableTableWidget> mView;
97
98 // Slots
101};
102
103/*******************************************************************************
104 * End of File
105 ******************************************************************************/
106
107} // namespace editor
108} // namespace librepcb
109
110#endif
The ComponentSymbolVariantItem class represents one symbol of a component symbol variant.
Definition: componentsymbolvariantitem.h:54
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition: workspace.h:54
The ComponentSymbolVariantItemListEditorWidget class.
Definition: componentsymbolvariantitemlisteditorwidget.h:53
ComponentSymbolVariantItemList::OnElementEditedSlot mOnItemEditedSlot
Definition: componentsymbolvariantitemlisteditorwidget.h:100
ComponentSymbolVariantItemListEditorWidget(QWidget *parent=nullptr) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:43
void setReferences(const Workspace &ws, const IF_GraphicsLayerProvider &layerProvider, ComponentSymbolVariantItemList &items, const std::shared_ptr< const LibraryElementCache > &symbolCache, UndoStack *undoStack) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:106
const Workspace * mWorkspace
Definition: componentsymbolvariantitemlisteditorwidget.h:95
void setReadOnly(bool readOnly) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:101
void itemEdited(const ComponentSymbolVariantItemList &list, int index, const std::shared_ptr< const ComponentSymbolVariantItem > &item, ComponentSymbolVariantItem::Event event) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:157
QScopedPointer< ComponentSymbolVariantItemListModel > mModel
Definition: componentsymbolvariantitemlisteditorwidget.h:93
QScopedPointer< EditableTableWidget > mView
Definition: componentsymbolvariantitemlisteditorwidget.h:94
ComponentSymbolVariantItemListEditorWidget(const ComponentSymbolVariantItemListEditorWidget &other)=delete
ComponentSymbolVariantItemList::OnEditedSlot mOnItemListEditedSlot
Definition: componentsymbolvariantitemlisteditorwidget.h:99
~ComponentSymbolVariantItemListEditorWidget() noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:94
void resetReferences() noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:124
void btnSymbolBrowseClicked(const QPersistentModelIndex &itemIndex) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:179
const IF_GraphicsLayerProvider * mLayerProvider
Definition: componentsymbolvariantitemlisteditorwidget.h:96
void itemListEdited(const ComponentSymbolVariantItemList &list, int index, const std::shared_ptr< const ComponentSymbolVariantItem > &item, ComponentSymbolVariantItemList::Event event) noexcept
Definition: componentsymbolvariantitemlisteditorwidget.cpp:139
The ComponentSymbolVariantItemListModel class.
Definition: componentsymbolvariantitemlistmodel.h:50
A QTableView subclass which adds buttons to edit the underlying model.
Definition: editabletablewidget.h:42
The IF_GraphicsLayerProvider class defines an interface for classes which provide layers.
Definition: graphicslayer.h:111
Cache for fast access to library elements.
Definition: libraryelementcache.h:55
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:106
Definition: occmodel.cpp:77