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_EDITOR_COMPONENTSYMBOLVARIANTLISTWIDGET_H
21#define LIBREPCB_EDITOR_COMPONENTSYMBOLVARIANTLISTWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39class ComponentSymbolVariantListModel;
40class EditableTableWidget;
41class UndoStack;
42
43/*******************************************************************************
44 * Class ComponentSymbolVariantListWidget
45 ******************************************************************************/
46
50class ComponentSymbolVariantListWidget final : public QWidget {
51 Q_OBJECT
52
53public:
54 // Constructors / Destructor
55 explicit ComponentSymbolVariantListWidget(QWidget* parent = nullptr) noexcept;
57 const ComponentSymbolVariantListWidget& other) = delete;
59
60 // Setters
61 void setFrameStyle(int style) noexcept;
62 void setReadOnly(bool readOnly) noexcept;
63 void setReferences(
64 UndoStack* undoStack, ComponentSymbolVariantList* list,
65 IF_ComponentSymbolVariantEditorProvider* editorProvider) noexcept;
66
67 // Operator Overloadings
69 const ComponentSymbolVariantListWidget& rhs) = delete;
70
71private: // Methods
72 void btnEditClicked(const QPersistentModelIndex& itemIndex) noexcept;
73 void viewDoubleClicked(const QModelIndex& index) noexcept;
74 void editVariant(const Uuid& uuid) noexcept;
75
76private: // Data
78 QScopedPointer<EditableTableWidget> mView;
82};
83
84/*******************************************************************************
85 * End of File
86 ******************************************************************************/
87
88} // namespace editor
89} // namespace librepcb
90
91#endif
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The ComponentSymbolVariantListModel class.
Definition: componentsymbolvariantlistmodel.h:46
The ComponentSymbolVariantListWidget class.
Definition: componentsymbolvariantlistwidget.h:50
void viewDoubleClicked(const QModelIndex &index) noexcept
Definition: componentsymbolvariantlistwidget.cpp:126
ComponentSymbolVariantListWidget(const ComponentSymbolVariantListWidget &other)=delete
void setReadOnly(bool readOnly) noexcept
Definition: componentsymbolvariantlistwidget.cpp:99
ComponentSymbolVariantListWidget(QWidget *parent=nullptr) noexcept
Definition: componentsymbolvariantlistwidget.cpp:43
void setReferences(UndoStack *undoStack, ComponentSymbolVariantList *list, IF_ComponentSymbolVariantEditorProvider *editorProvider) noexcept
Definition: componentsymbolvariantlistwidget.cpp:103
void editVariant(const Uuid &uuid) noexcept
Definition: componentsymbolvariantlistwidget.cpp:138
QScopedPointer< EditableTableWidget > mView
Definition: componentsymbolvariantlistwidget.h:78
void btnEditClicked(const QPersistentModelIndex &itemIndex) noexcept
Definition: componentsymbolvariantlistwidget.cpp:117
ComponentSymbolVariantList * mSymbolVariantList
Definition: componentsymbolvariantlistwidget.h:79
QScopedPointer< ComponentSymbolVariantListModel > mModel
Definition: componentsymbolvariantlistwidget.h:77
IF_ComponentSymbolVariantEditorProvider * mEditorProvider
Definition: componentsymbolvariantlistwidget.h:81
void setFrameStyle(int style) noexcept
Definition: componentsymbolvariantlistwidget.cpp:95
UndoStack * mUndoStack
Definition: componentsymbolvariantlistwidget.h:80
~ComponentSymbolVariantListWidget() noexcept
Definition: componentsymbolvariantlistwidget.cpp:88
A QTableView subclass which adds buttons to edit the underlying model.
Definition: editabletablewidget.h:42
The IF_ComponentSymbolVariantEditorProvider interface.
Definition: if_componentsymbolvarianteditorprovider.h:46
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:106
Definition: occmodel.cpp:77