Make buttons toggleable by single clicking

This commit is contained in:
xypwn
2020-04-04 14:07:16 +02:00
parent 5340635389
commit 7ade16be8b
20 changed files with 80 additions and 65 deletions

13
Part.h
View File

@@ -3,7 +3,6 @@
#include <QGraphicsItem>
#include <QList>
#include <QLineEdit>
#include "ePartType.h"
@@ -59,9 +58,6 @@ public:
void setWidth(int factor);
void addText(); //TODO
void addTextEdit(); //TODO
void recalculateLayout();
virtual QRectF boundingRect() const override;
@@ -70,7 +66,7 @@ public:
// Symbol to be drawn inside the circuitItem
virtual QPainterPath symbolPainterPath(QRect limits) = 0;
virtual QVariant itemChange(GraphicsItemChange change, const QVariant & value) override;
// Take the inputs and calculate the outputs based on the part's logic
// Takes the inputs and calculates the outputs based on the part's logic
virtual QVector<bool> compute(QVector<bool> inputs) = 0;
protected:
@@ -87,12 +83,17 @@ protected:
CircuitItemBaseShape m_baseShape;
QPointF m_oldPos;
QPointF m_dragBeginPos;
PartType::PartType m_partType;
int m_widthFactor;
virtual void partClickedEvent(){}
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
// Updates all of the outputs using the inputs, called by Logic
void updateState();