[Interest] [ Missing pixels when using drawLine ]
ashish raste
rasteashish at gmail.com
Wed Mar 14 08:48:20 CET 2012
*Hi all,
In continuation of my previous mail, I wanted to tell that I found this
link,
http://stackoverflow.com/questions/1219827/qt-mouse-skipping-not-updating-every-pixel-mousemoveeventwhich
talks about untracked pixels in mouseMoveEvent().
The drawLine() takes two pixels, and draws a line connecting them, adding/
interpolating the pixels-in-between. In my mouseMoveEvent, I have called a
function which performs this as:
void myPaint::mouseMoveEvent(QMouseEvent *event)
{
qDebug() << event->pos();
if ((event->buttons() & Qt::LeftButton) && scribbling) {
pixelList.append(event->pos());
drawLineTo(event->pos());
}
}
void ScribbleArea::drawLineTo(const QPoint &endPoint)
{
QPainter painter(image);
painter.setPen(QPen(Qt::blue, 1, Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
painter.setRenderHint(QPainter::Antialiasing);
painter.drawLine(lastPoint, endPoint);
lastPoint = endPoint; // lastPoint initially
initialized in mousePressEvent
update();
}
The qDebug() in mouseMoveEvent() shows that some pixels arent tracked. I
assume that the mouseMoveEvent can't happen for every pixel which are drawn.
Now, I am curious to know whether there is any way to calculate the
pixel-values, which are not tracked by the mouseMoveEvent()?
Thanks!
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120314/f32ad068/attachment.html>
More information about the Interest
mailing list