LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentassemblyoptionlisteditorwidget.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_COMPONENTASSEMBLYOPTIONLISTEDITORWIDGET_H
21#define LIBREPCB_EDITOR_COMPONENTASSEMBLYOPTIONLISTEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31/*******************************************************************************
32 * Namespace / Forward Declarations
33 ******************************************************************************/
34namespace librepcb {
35
36class ComponentInstance;
37class Project;
38class Workspace;
39
40namespace editor {
41
42class EditableTableWidget;
43class PartListModel;
44
45/*******************************************************************************
46 * Class ComponentAssemblyOptionListEditorWidget
47 ******************************************************************************/
48
52class ComponentAssemblyOptionListEditorWidget final : public QWidget {
53 Q_OBJECT
54
63
64public:
65 // Constructors / Destructor
67 QWidget* parent = nullptr) noexcept;
69 const ComponentAssemblyOptionListEditorWidget& other) = delete;
71
72 // Getters
73 const ComponentAssemblyOptionList& getOptions() const noexcept {
74 return mOptions;
75 }
76
77 // Setters
78 void setFrameStyle(int style) noexcept;
79 void setReferences(const Workspace* ws, const Project* project,
80 ComponentInstance* component) noexcept;
81
82 // Operator Overloadings
84 const ComponentAssemblyOptionListEditorWidget& rhs) = delete;
85
86signals:
87 void selectedPartChanged(std::shared_ptr<Part> part);
88
89private:
90 void addOption() noexcept;
91 bool addPart() noexcept;
92 void editOptionOrPart() noexcept;
93 void removeOptionOrPart() noexcept;
94 void itemChanged(QTreeWidgetItem* item, int column) noexcept;
95 void itemSelectionChanged() noexcept;
96 std::pair<int, int> getIndices(QTreeWidgetItem* item) noexcept;
98 const ComponentAssemblyOptionList& list, int index,
99 const std::shared_ptr<const ComponentAssemblyOption>& obj,
100 ComponentAssemblyOptionList::Event event) noexcept;
101
102private: // Data
103 QPointer<const Workspace> mWorkspace;
104 QPointer<const Project> mProject;
108 QScopedPointer<QTreeWidget> mTreeWidget;
109 QScopedPointer<QToolButton> mAddOptionButton;
110 QScopedPointer<QToolButton> mAddPartButton;
111 QScopedPointer<QToolButton> mEditButton;
112 QScopedPointer<QToolButton> mRemoveButton;
113
114 // Slots
116};
117
118/*******************************************************************************
119 * End of File
120 ******************************************************************************/
121
122} // namespace editor
123} // namespace librepcb
124
125#endif
The ComponentAssemblyOption class.
Definition componentassemblyoption.h:43
The ComponentInstance class.
Definition componentinstance.h:54
The Project class represents a whole (opened) project with all its content.
Definition project.h:71
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The ComponentAssemblyOptionListEditorWidget class.
Definition componentassemblyoptionlisteditorwidget.h:52
const ComponentAssemblyOptionList & getOptions() const noexcept
Definition componentassemblyoptionlisteditorwidget.h:73
void itemSelectionChanged() noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:416
void addOption() noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:200
void setReferences(const Workspace *ws, const Project *project, ComponentInstance *component) noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:175
QScopedPointer< QToolButton > mRemoveButton
Definition componentassemblyoptionlisteditorwidget.h:112
void optionListEdited(const ComponentAssemblyOptionList &list, int index, const std::shared_ptr< const ComponentAssemblyOption > &obj, ComponentAssemblyOptionList::Event event) noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:448
QPointer< ComponentInstance > mComponent
Definition componentassemblyoptionlisteditorwidget.h:105
ComponentAssemblyOptionListEditorWidget & operator=(const ComponentAssemblyOptionListEditorWidget &rhs)=delete
std::pair< int, int > getIndices(QTreeWidgetItem *item) noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:430
ComponentAssemblyOptionList mOptions
Definition componentassemblyoptionlisteditorwidget.h:107
QScopedPointer< QToolButton > mAddOptionButton
Definition componentassemblyoptionlisteditorwidget.h:109
void editOptionOrPart() noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:328
void itemChanged(QTreeWidgetItem *item, int column) noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:362
QPointer< const Project > mProject
Definition componentassemblyoptionlisteditorwidget.h:104
bool addPart() noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:263
QScopedPointer< QTreeWidget > mTreeWidget
Definition componentassemblyoptionlisteditorwidget.h:108
void removeOptionOrPart() noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:339
QPointer< const Workspace > mWorkspace
Definition componentassemblyoptionlisteditorwidget.h:103
void selectedPartChanged(std::shared_ptr< Part > part)
void setFrameStyle(int style) noexcept
Definition componentassemblyoptionlisteditorwidget.cpp:170
bool mMultiAssemblyVariantMode
Definition componentassemblyoptionlisteditorwidget.h:106
Column
Definition componentassemblyoptionlisteditorwidget.h:55
@ _COLUMN_COUNT
Definition componentassemblyoptionlisteditorwidget.h:61
@ COLUMN_MPN
Definition componentassemblyoptionlisteditorwidget.h:57
@ COLUMN_ATTRIBUTES
Definition componentassemblyoptionlisteditorwidget.h:59
@ COLUMN_MOUNT
Definition componentassemblyoptionlisteditorwidget.h:60
@ COLUMN_DEVICE
Definition componentassemblyoptionlisteditorwidget.h:56
@ COLUMN_MANUFACTURER
Definition componentassemblyoptionlisteditorwidget.h:58
QScopedPointer< QToolButton > mAddPartButton
Definition componentassemblyoptionlisteditorwidget.h:110
QScopedPointer< QToolButton > mEditButton
Definition componentassemblyoptionlisteditorwidget.h:111
ComponentAssemblyOptionList::OnEditedSlot mOnListEditedSlot
Definition componentassemblyoptionlisteditorwidget.h:115
Definition occmodel.cpp:76
Definition uuid.h:186