wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
ElementOrientation.h
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8#pragma once
9
10#include <QtGlobal>
11
12class GraphicElement;
13class Port;
14
26{
27public:
30 : m_owner(owner)
31 {
32 }
33
35 qreal angle() const { return m_angle; }
36
38 void setRotation(qreal angle);
39
41 bool isFlippedX() const { return m_flippedX; }
42
44 bool isFlippedY() const { return m_flippedY; }
45
47 void setFlippedX(bool flipped);
48
50 void setFlippedY(bool flipped);
51
55 void rotatePorts();
56
64 void orientPort(Port *port);
65
66 // --- Raw setters: load-time only, no side effects (caller applies afterwards) ---
67
69 void setAngleRaw(qreal angle) { m_angle = angle; }
71 void setFlippedXRaw(bool flipped) { m_flippedX = flipped; }
73 void setFlippedYRaw(bool flipped) { m_flippedY = flipped; }
74
78 {
79 setRotation(m_angle);
80 applyFlipTransform();
81 }
82
83private:
85 void applyFlipTransform();
86
87 GraphicElement *m_owner;
88
89 qreal m_angle = 0;
90 bool m_flippedX = false;
91 bool m_flippedY = false;
92};
bool isFlippedY() const
Returns true if this element is mirrored along the Y axis (vertical flip).
void setFlippedXRaw(bool flipped)
Sets the horizontal flip flag without re-applying the transform. Load-time only.
ElementOrientation(GraphicElement *owner)
Constructs the orientation state bound to its owning owner element.
void orientPort(Port *port)
Orients port for the current rotation + flip state.
void setFlippedX(bool flipped)
Sets the horizontal mirror state and updates the item transform.
void setFlippedYRaw(bool flipped)
Sets the vertical flip flag without re-applying the transform. Load-time only.
void setFlippedY(bool flipped)
Sets the vertical mirror state and updates the item transform.
void setRotation(qreal angle)
Rotates to angle degrees (normalised to [0, 360)) and updates port positions.
qreal angle() const
Returns the current rotation angle in degrees.
bool isFlippedX() const
Returns true if this element is mirrored along the X axis (horizontal flip).
void setAngleRaw(qreal angle)
Sets the angle without re-applying the transform. Load-time only.
Abstract base class for all graphical circuit elements in wiRedPanda.
Abstract base class for circuit element ports (connection endpoints).
Definition Port.h:39