From 75946e767f2572dce62a6700efb1671dee0abb28 Mon Sep 17 00:00:00 2001 From: Artem Proskurnev Date: Mon, 10 Jan 2022 10:22:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BE=D1=80=D0=B4=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=D1=82.=20=D0=97=D0=B0=D0=BB=D0=B8=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0:=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D1=86=D0=B2?= =?UTF-8?q?=D0=B5=D1=82=20=D0=B8=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qtsgraph.cpp | 20 +++++++++++++++++--- qtsgraph.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/qtsgraph.cpp b/qtsgraph.cpp index 29279ad..f7e149d 100644 --- a/qtsgraph.cpp +++ b/qtsgraph.cpp @@ -245,6 +245,18 @@ void QTSGraph::SetFillStyle(int Pattern, QRgb Color) Brush.setColor(QColor(Color)); } +void QTSGraph::SetFillStyle(QRgb Color) +{ + int Pattern = 1; + SetFillStyle(Pattern, Color); +} + +void QTSGraph::SetNoFill() +{ + int Pattern = 0; + Brush.setStyle(Qt::BrushStyle(Pattern)); +} + void QTSGraph::SetPenStyle(int PenWidth, int PenStyle) { Pen.setWidth(PenWidth); @@ -334,9 +346,11 @@ void QTSGraph::paintEvent(QPaintEvent *event) p.drawLine(Canvas.width() / 2, Canvas.height() - 1, Canvas.width() / 2 - 10, Canvas.height() - 1 - 10); p.drawText(Canvas.width() / 2 - 20, Canvas.height() - 2, "Y"); } - p.drawLine(0, Canvas.height() / 2, Canvas.width() - 1, Canvas.height() / 2); - p.drawLine(Canvas.width() - 1, Canvas.height() / 2, Canvas.width() - 1 - 10, Canvas.height() / 2 + 10); - p.drawLine(Canvas.width() - 1, Canvas.height() / 2, Canvas.width() - 1 - 10, Canvas.height() / 2 - 10); + p.drawLine(0, Canvas.height() / 2, Canvas.width() - 1, Canvas.height() / 2 - correctY); + p.drawLine(Canvas.width() - 1, Canvas.height() / 2 - correctY, + Canvas.width() - 1 - 10, Canvas.height() / 2 - correctY + 10); + p.drawLine(Canvas.width() - 1, Canvas.height() / 2 - correctY, + Canvas.width() - 1 - 10, Canvas.height() / 2 - correctY - 10); p.drawText(Canvas.width() - 1 - 10, Canvas.height() / 2 + 20, "X"); } else diff --git a/qtsgraph.h b/qtsgraph.h index 4810d33..7c32bd6 100644 --- a/qtsgraph.h +++ b/qtsgraph.h @@ -98,6 +98,8 @@ public: void SetColor(const QColor &c = Qt::black); void SetColor(const QRgb c = 0x00000000); void SetFillStyle(int Pattern, QRgb Color); // Стиль и цвет заливки + void SetFillStyle(QRgb Color); // Цвет заливки со стилем SolidPattern + void SetNoFill(); // Установить стиль заливки в NoBrush /* 0 - NoBrush 1 - SolidPattern