qt/LedOK/LoQClass/loqgraphicsview.cpp

39 lines
1.0 KiB
C++
Raw Normal View History

2022-01-04 18:11:48 +08:00
#include "loqgraphicsview.h"
LoQGraphicsview::LoQGraphicsview()
{
}
void LoQGraphicsview::paintEvent(QPaintEvent * event)
{
QGraphicsView::paintEvent(event);
QPainter painter(this);
QPen CitiePen=QPen(QColor::fromRgb(255, 0, 0),2,Qt::SolidLine);
painter.setPen(CitiePen);
painter.drawLine(QPointF(0,0),QPointF(400,400));
if(true)
{
switch (0) {
case 0:
painter.setPen(CitiePen);
painter.drawLine(QPointF(0,0),QPointF(400,400));
break;
case 1:
painter.setPen(CitiePen);
painter.drawLine(QPointF(rect().topLeft()),QPointF(rect().topRight()));
break;
case 2:
painter.setPen(CitiePen);
painter.drawLine(QPointF(rect().topRight()),QPointF(rect().bottomRight()));
break;
case 3:
painter.setPen(CitiePen);
painter.drawLine(QPointF(rect().bottomLeft()),QPointF(rect().bottomRight()));
break;
default:
break;
}
}
}