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