Add saveable labels for parts and connectors

This commit is contained in:
xypwn
2020-04-03 19:38:01 +02:00
parent de3d0823fb
commit 5340635389
26 changed files with 341 additions and 63 deletions

View File

@@ -8,6 +8,7 @@
class Part;
class Wire;
class Scene;
class Label;
class Connector : private QGraphicsItem
{
@@ -26,6 +27,9 @@ public:
Part* parentPart();
void setLabel(const QString& text = QString());
QString label() const;
QRectF boundingRect() const override; // For drawing
QPainterPath shape() const override; // For selection ("Hitbox")
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
@@ -42,6 +46,8 @@ private:
bool m_state = false;
bool m_selected = false; // Separate from regular selection, for creating connections
Label* m_label = nullptr;
void select(); // Called by MainWindow
void unselect(); // Called by MainWindow
};