8 #include <QStyleOptionGraphicsItem>
13 #include <QGraphicsScene>
17 qreal StandardGraphicsNet::sAlpha;
19 qreal StandardGraphicsNet::sWireLength;
20 qreal StandardGraphicsNet::sLeftArrowOffset;
21 qreal StandardGraphicsNet::sRightArrowOffset;
22 qreal StandardGraphicsNet::sArrowLeftXShift;
23 qreal StandardGraphicsNet::sArrowRightXShift;
24 qreal StandardGraphicsNet::sArrowSideLength;
25 qreal StandardGraphicsNet::sArrowWidth;
26 qreal StandardGraphicsNet::sArrowHeight;
30 qreal StandardGraphicsNet::sSplitRadius;
37 sRightArrowOffset = 3;
40 sArrowRightXShift = 3;
41 sArrowSideLength = 12;
44 sArrowWidth = sArrowLeftXShift + sArrowSideLength + sArrowRightXShift;
46 QPointF point(sArrowLeftXShift, -sArrowHeight / 2);
48 #if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
56 point.
setX(point.
x() + sArrowSideLength);
58 point.
setX(point.
x() + sArrowRightXShift);
61 point.
setX(point.
x() - sArrowRightXShift);
62 point.
setY(sArrowHeight / 2);
64 point.
setX(point.
x() - sArrowSideLength);
73 if (
sLod >= graph_widget_constants::sNetFadeInLod &&
sLod <= graph_widget_constants::sNetFadeOutLod)
74 sAlpha = (
sLod - graph_widget_constants::sNetFadeInLod) / (graph_widget_constants::sNetFadeOutLod - graph_widget_constants::sNetFadeInLod);
81 for (
const QPointF& point : knots)
87 qreal smallest_x = std::numeric_limits<qreal>::max();
88 qreal biggest_x = std::numeric_limits<qreal>::min();
90 qreal smallest_y = std::numeric_limits<qreal>::max();
91 qreal biggest_y = std::numeric_limits<qreal>::min();
93 for (
const HLine& h : l.mHLines)
98 if (h.
mBigX > biggest_x)
101 if (h.
y < smallest_y)
112 for (
const VLine& v : l.mVLines)
114 if (v.
x < smallest_x)
116 else if (v.
x > biggest_x)
122 if (v.
mBigY > biggest_y)
133 mRect =
QRectF(smallest_x - padding, smallest_y - padding, biggest_x - smallest_x + padding, biggest_y - smallest_y + padding);
147 if (
sLod > graph_widget_constants::sNetFadeInLod)
162 for (
const QPointF& point : mSplits)
163 painter->
drawEllipse(point, sSplitRadius, sSplitRadius);
171 #ifdef HAL_DEBUG_GUI_GRAPH_WIDGET
183 assert(mSmallX < mBigX);
185 mHLines.append(
HLine{mSmallX, mBigX,
y});
190 assert(mSmallY < mBigY);
192 mVLines.append(
VLine{
x, mSmallY, mBigY});
QColor penColor(QStyle::State state, const QColor &colorHint=QColor()) const
The basic net class all other nets inherit from.
static void loadSettings()
static void updateAlpha()
StandardGraphicsNet(Net *n, const Lines &l, const QList< QPointF > &knots=QList< QPointF >())
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
option(PL_GUI "PL_GUI" ON) if(PL_GUI OR BUILD_ALL_PLUGINS) cmake_minimum_required(VERSION 3.1.0) if(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) set(Qt5_DIR "/usr/local/opt/qt@5/lib/cmake") endif(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) find_package(Qt5 COMPONENTS Core REQUIRED) find_package(Qt5 COMPONENTS Widgets REQUIRED) if(Qt5Widgets_FOUND) message(VERBOSE "Qt5Widgets_INCLUDE_DIRS
void setColor(const QColor &color)
void setStyle(Qt::BrushStyle style)
void setAlphaF(qreal alpha)
void drawEllipse(const QRectF &rectangle)
void drawLines(const QLineF *lines, int lineCount)
void drawPath(const QPainterPath &path)
QPainter::RenderHints renderHints() const const
void setBrush(const QBrush &brush)
void setPen(const QColor &color)
void setRenderHint(QPainter::RenderHint hint, bool on)
void addEllipse(const QRectF &boundingRectangle)
void addRect(const QRectF &rectangle)
void lineTo(const QPointF &endPoint)
bool isCosmetic() const const
void setColor(const QColor &color)
void setCosmetic(bool cosmetic)
void setStyle(Qt::PenStyle style)
void append(const T &value)
void appendHLine(const qreal mSmallX, const qreal mBigX, const qreal y)
void appendVLine(const qreal x, const qreal mSmallY, const qreal mBigY)