LibrePCB Developers Documentation
Loading...
Searching...
No Matches
librarydependenciesmodel.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_LIBRARYDEPENDENCIESMODEL_H
21#define LIBREPCB_EDITOR_LIBRARYDEPENDENCIESMODEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class Workspace;
38
39namespace editor {
40
41/*******************************************************************************
42 * Class LibraryDependenciesModel
43 ******************************************************************************/
44
49 : public QObject,
50 public slint::Model<ui::LibraryDependency> {
51 Q_OBJECT
52
53public:
54 // Constructors / Destructor
57 explicit LibraryDependenciesModel(const Workspace& ws, const Uuid& libUuid,
58 QObject* parent = nullptr) noexcept;
59 ~LibraryDependenciesModel() noexcept;
60
61 // General Methods
62 const QSet<Uuid>& getUuids() const noexcept { return mCheckedUuids; }
63 void setUuids(const QSet<Uuid>& uuids) noexcept;
64
65 // Implementations
66 std::size_t row_count() const override;
67 std::optional<ui::LibraryDependency> row_data(std::size_t i) const override;
68 void set_row_data(std::size_t i,
69 const ui::LibraryDependency& data) noexcept override;
70
71 // Operator Overloadings
73 delete;
74
75signals:
76 void modified(const QSet<Uuid>& uuids);
77
78private:
79 void refresh() noexcept;
80
81 const Workspace& mWs;
84 std::vector<ui::LibraryDependency> mItems;
85};
86
87/*******************************************************************************
88 * End of File
89 ******************************************************************************/
90
91} // namespace editor
92} // namespace librepcb
93
94#endif
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The LibraryDependenciesModel class.
Definition librarydependenciesmodel.h:50
std::vector< ui::LibraryDependency > mItems
Definition librarydependenciesmodel.h:84
LibraryDependenciesModel & operator=(const LibraryDependenciesModel &rhs)=delete
const Workspace & mWs
Definition librarydependenciesmodel.h:81
void set_row_data(std::size_t i, const ui::LibraryDependency &data) noexcept override
Definition librarydependenciesmodel.cpp:80
void refresh() noexcept
Definition librarydependenciesmodel.cpp:103
const Uuid mLibUuid
Definition librarydependenciesmodel.h:82
std::size_t row_count() const override
Definition librarydependenciesmodel.cpp:71
LibraryDependenciesModel(const LibraryDependenciesModel &other)=delete
void setUuids(const QSet< Uuid > &uuids) noexcept
Definition librarydependenciesmodel.cpp:60
QSet< Uuid > mCheckedUuids
Definition librarydependenciesmodel.h:83
const QSet< Uuid > & getUuids() const noexcept
Definition librarydependenciesmodel.h:62
void modified(const QSet< Uuid > &uuids)
std::optional< ui::LibraryDependency > row_data(std::size_t i) const override
Definition librarydependenciesmodel.cpp:75
Definition occmodel.cpp:77
Definition uuid.h:186