SILICON
Loading...
Searching...
No Matches
propertyPanel.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 */
9
10#pragma once
11
12#include <ui/lifetime.hpp>
13
14#include <functional>
15#include <optional>
16
17#include <QObject>
18#include <QSpinBox>
19
21
22class QDockWidget;
23class QUndoStack;
24
25namespace SILICON::ui {
26
27class DiagramScene;
28class ProjectTree;
29
31class PropertyPanel : public QObject {
32public:
33 PropertyPanel(QDockWidget* dock, DiagramScene* scene, ProjectTree* tree,
34 QUndoStack* history,
35 std::optional<SILICON::project::ProjectInfo>& projectInfo,
36 const QString& fileName, std::function<void()> rebuildTree);
37
38 void refresh();
39
40private:
41 QDockWidget* propertyDock;
44 QUndoStack* undoStack;
45 std::optional<SILICON::project::ProjectInfo>& currentProjectInfo;
46 const QString& currentFileName;
47 std::function<void()> rebuildProjectTree;
49};
50
51class PropertySpinBox : public QSpinBox {
52 Q_OBJECT
53
54public:
55 explicit PropertySpinBox(QWidget* parent = nullptr);
56 void setMixed(bool mixed, const QString& placeholder = QString());
57 [[nodiscard]] bool isMixed() const;
58
59protected:
60 [[nodiscard]] QString textFromValue(int val) const override;
61
62private:
63 bool m_isMixed = false;
64};
65
66} // namespace SILICON::ui
Graphics scene for the circuit diagram editor.
Project document navigator used by the SILICON editor.
std::optional< SILICON::project::ProjectInfo > & currentProjectInfo
PropertyPanel(QDockWidget *dock, DiagramScene *scene, ProjectTree *tree, QUndoStack *history, std::optional< SILICON::project::ProjectInfo > &projectInfo, const QString &fileName, std::function< void()> rebuildTree)
const QString & currentFileName
std::function< void()> rebuildProjectTree
void setMixed(bool mixed, const QString &placeholder=QString())
QString textFromValue(int val) const override
PropertySpinBox(QWidget *parent=nullptr)