I now have a TXT file with 100,000 two-dimensional (x, y) points.
I want to display it in a QGraphicsView, so I customized a QGraphicsItem, and the paint function draws a point.
But I found that when I zoomed in, this actually drew a rectangle:
void CustomPointItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
QPen pen{};
pen.setColor({ 255,0,0 });
pen.setWidth(1);
painter->setPen(pen);
painter->drawPoint(0, 0);
}
QRectF CustomPointItem::boundingRect() const
{
return QRectF{ -1,1,2,2};
}
Is this how it should be? Or I did something wrong with the code?
I want to know how to better display very large number of points in Qt.
