|
|
@ -267,13 +267,10 @@ void QTSGraph::paintEvent(QPaintEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPainter p(this); |
|
|
|
QPainter p(this); |
|
|
|
p.drawPixmap(0, 0, Canvas); |
|
|
|
p.drawPixmap(0, 0, Canvas); |
|
|
|
|
|
|
|
int correctY = 0; |
|
|
|
|
|
|
|
int mult = 1; |
|
|
|
if(AxesVisible) |
|
|
|
if(AxesVisible) |
|
|
|
{ |
|
|
|
{ |
|
|
|
p.setPen(QPen(QBrush(QColor(Qt::lightGray)), 1)); |
|
|
|
|
|
|
|
p.drawLine(Canvas.width() / 2, 0, Canvas.width() / 2, Canvas.height() - 1); |
|
|
|
|
|
|
|
p.drawLine(0, Canvas.height() / 2, Canvas.width() - 1, Canvas.height() / 2); |
|
|
|
|
|
|
|
p.drawText(Canvas.width() / 2 + 2, 12, QString::number(Canvas.width() / 2)); |
|
|
|
|
|
|
|
p.drawText(2, Canvas.height() / 2 - 2, QString::number(Canvas.height() / 2)); |
|
|
|
|
|
|
|
p.setPen(QPen(QBrush(QColor(Qt::red)), 3)); |
|
|
|
p.setPen(QPen(QBrush(QColor(Qt::red)), 3)); |
|
|
|
if(SwapYAxis) |
|
|
|
if(SwapYAxis) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -283,17 +280,7 @@ void QTSGraph::paintEvent(QPaintEvent *event) |
|
|
|
p.drawLine(0, Canvas.height() - 1, 0, 0); |
|
|
|
p.drawLine(0, Canvas.height() - 1, 0, 0); |
|
|
|
p.drawLine(10, 10, 0, 0); |
|
|
|
p.drawLine(10, 10, 0, 0); |
|
|
|
p.drawText(12, 12, "Y"); |
|
|
|
p.drawText(12, 12, "Y"); |
|
|
|
|
|
|
|
correctY = 1; |
|
|
|
p.setPen(QPen(QBrush(QColor(0xDDDDDD)), 1)); |
|
|
|
|
|
|
|
p.drawLine(Canvas.width() / 4, 0, Canvas.width() / 4, Canvas.height() - 1); |
|
|
|
|
|
|
|
p.drawLine(0, Canvas.height() / 4, Canvas.width() - 1, Canvas.height() / 4); |
|
|
|
|
|
|
|
p.drawText(Canvas.width() / 4 + 2, 12, QString::number(Canvas.width() / 4)); |
|
|
|
|
|
|
|
p.drawText(2, Canvas.height() / 4 - 2, QString::number(3 * Canvas.height() / 4)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p.drawLine(3 * Canvas.width() / 4, 0, 3 * Canvas.width() / 4, Canvas.height() - 1); |
|
|
|
|
|
|
|
p.drawLine(0, 3 * Canvas.height() / 4, Canvas.width() - 1, 3 * Canvas.height() / 4); |
|
|
|
|
|
|
|
p.drawText(3 * Canvas.width() / 4 + 2, 12, QString::number(3 * Canvas.width() / 4)); |
|
|
|
|
|
|
|
p.drawText(2, 3 * Canvas.height() / 4 - 2, QString::number(Canvas.height() / 4)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -303,18 +290,25 @@ void QTSGraph::paintEvent(QPaintEvent *event) |
|
|
|
p.drawLine(0, Canvas.height() - 1, 0, 0); |
|
|
|
p.drawLine(0, Canvas.height() - 1, 0, 0); |
|
|
|
p.drawLine(10, Canvas.height() - 10, 0, Canvas.height() - 1); |
|
|
|
p.drawLine(10, Canvas.height() - 10, 0, Canvas.height() - 1); |
|
|
|
p.drawText(13, Canvas.height() - 2, "Y"); |
|
|
|
p.drawText(13, Canvas.height() - 2, "Y"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
p.setPen(QPen(QBrush(QColor(Qt::lightGray)), 1)); |
|
|
|
|
|
|
|
p.drawLine(Canvas.width() / 2, 0, Canvas.width() / 2, Canvas.height() - 1); |
|
|
|
|
|
|
|
p.drawLine(0, Canvas.height() / 2 - correctY, Canvas.width() - 1, Canvas.height() / 2 - correctY); |
|
|
|
|
|
|
|
p.drawText(Canvas.width() / 2 + 2, 12, QString::number(Canvas.width() / 2)); |
|
|
|
|
|
|
|
p.drawText(2, Canvas.height() / 2 - 2, QString::number(Canvas.height() / 2)); |
|
|
|
|
|
|
|
|
|
|
|
p.setPen(QPen(QBrush(QColor(0xDDDDDD)), 1)); |
|
|
|
p.setPen(QPen(QBrush(QColor(0xDDDDDD)), 1)); |
|
|
|
p.drawLine(Canvas.width() / 4, 0, Canvas.width() / 4, Canvas.height() - 1); |
|
|
|
p.drawLine(Canvas.width() / 4, 0, Canvas.width() / 4, Canvas.height() - 1); |
|
|
|
p.drawLine(0, Canvas.height() / 4, Canvas.width() - 1, Canvas.height() / 4); |
|
|
|
p.drawLine(0, Canvas.height() / 4 - correctY, Canvas.width() - 1, Canvas.height() / 4 - correctY); |
|
|
|
p.drawText(Canvas.width() / 4 + 2, 12, QString::number(Canvas.width() / 4)); |
|
|
|
p.drawText(Canvas.width() / 4 + 2, 12, QString::number(Canvas.width() / 4)); |
|
|
|
p.drawText(2, Canvas.height() / 4 - 2, QString::number(Canvas.height() / 4)); |
|
|
|
if(correctY) mult = 3; |
|
|
|
|
|
|
|
p.drawText(2, Canvas.height() / 4 - 2, QString::number(mult * Canvas.height() / 4)); |
|
|
|
|
|
|
|
|
|
|
|
p.drawLine(3 * Canvas.width() / 4, 0, 3 * Canvas.width() / 4, Canvas.height() - 1); |
|
|
|
p.drawLine(3 * Canvas.width() / 4, 0, 3 * Canvas.width() / 4, Canvas.height() - 1); |
|
|
|
p.drawLine(0, 3 * Canvas.height() / 4, Canvas.width() - 1, 3 * Canvas.height() / 4); |
|
|
|
p.drawLine(0, 3 * Canvas.height() / 4 - 1, Canvas.width() - 1, 3 * Canvas.height() / 4 - correctY); |
|
|
|
p.drawText(3 * Canvas.width() / 4 + 2, 12, QString::number(3 * Canvas.width() / 4)); |
|
|
|
p.drawText(3 * Canvas.width() / 4 + 2, 12, QString::number(3 * Canvas.width() / 4)); |
|
|
|
p.drawText(2, 3 * Canvas.height() / 4 - 2, QString::number(3 * Canvas.height() / 4)); |
|
|
|
mult = correctY ? 1 : 3; |
|
|
|
} |
|
|
|
p.drawText(2, 3 * Canvas.height() / 4 - 2, QString::number(mult * Canvas.height() / 4)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|