From 4dbe330f89c13aca50f0f822e58cd49d756a972c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D0=BD=D1=91=D0=B2?= Date: Tue, 12 Jan 2021 02:17:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=BE=D0=B4=D0=B0=20=D1=82=D0=B5=D0=BA=D1=81=D1=82?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 6 +++--- qtsgraph.cpp | 6 +++--- qtsgraph.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 1aceffb..f011bda 100644 --- a/main.cpp +++ b/main.cpp @@ -27,18 +27,18 @@ void QTSGraph::PaintBox() Rectangle(0, 0, 599, 599); QColor c = Qt::blue; SetColor(c); - SetTextStyle(0, 45, 10); + SetTextStyle(10, 45, 0); OutTextXY(70, 70, "Hello world!"); SetTextStyle(1, 0, 20); OutTextXY(170, 50, "Кликните мышкой..."); int m = ReadMouseButton(); SetColor(clRed); - SetTextStyle(1, 0, 20); + SetTextStyle(20, 0, 1); if(m == 1) OutTextXY(150, 80, "Нажата левая кнопка"); else if(m == 2) OutTextXY(150, 80, "Нажата правая кнопка"); else if(m == 3) OutTextXY(150, 80, "Нажата средняя кнопка"); else OutTextXY(150, 80, "Нажата неизвестная кнопка"); - SetTextStyle(2, 180, 30); + SetTextStyle(30, 180, 2); OutTextXY(460, 550, "Hello world!"); SetColor(0x999999); SetPenStyle(5); diff --git a/qtsgraph.cpp b/qtsgraph.cpp index 7d04579..90d1d88 100644 --- a/qtsgraph.cpp +++ b/qtsgraph.cpp @@ -86,7 +86,7 @@ QTSGraph::QTSGraph(int w, int h, int x, int y, QWidget *parent) Pen = QPen(QBrush(QColor(DefaultColor)), 1); Font = QFont(); Brush = QBrush(QColor(DefaultColor),Qt::NoBrush); - SetTextStyle(1, 0, 10); + SetTextStyle(10); ResetInterval = 1000; ResetTimer = new QTimer(); connect(ResetTimer, SIGNAL(timeout()), this, SLOT(slotResetTimer())); @@ -137,7 +137,7 @@ void QTSGraph::OutTextXY(int x, int y, std::string caption) painter.setFont(Font); double r, b, sa, ca, sb, cb, xn, yn; if(SwapYAxis) y = Canvas.height() - y - 1; - b = TextDirection*3.14159/180; + b = TextDirection * 3.14159 / 180; r = sqrt(x * x + y * y); sa = y / r; ca = x / r; @@ -223,7 +223,7 @@ void QTSGraph::SetPenWidth(int PenWidth) Pen.setWidth(PenWidth); } -void QTSGraph::SetTextStyle(int idFont, int Direction, int CharSize) +void QTSGraph::SetTextStyle(int CharSize, int Direction, int idFont) { QString f; if(idFont == 0) f = "serif"; diff --git a/qtsgraph.h b/qtsgraph.h index 6e86bc7..340e499 100644 --- a/qtsgraph.h +++ b/qtsgraph.h @@ -119,7 +119,7 @@ public: 5 - DashDotDotLine */ void SetPenWidth(int PenWidth); - void SetTextStyle(int idFont, int Direction, int CharSize); + void SetTextStyle(int CharSize, int Direction = 0, int idFont = 0); /* 0 - serif 1 - sans