QClipboard::setImage() oddity with non-square images

119 Views Asked by At

The code below works fine:

   QClipboard *clipboard = QApplication::clipboard();
   QImage image( 400, 400, QImage::Format_RGB32);
   image.fill( Qt::white );
   clipboard->setImage( image,  QClipboard::Clipboard );

But if it set QImage's dimension to different values (say: 399x400), I get a flood of messages like:

QImage::pixel: coordinate (392,399) out of range
QImage::pixel: coordinate (393,399) out of range
QImage::pixel: coordinate (394,399) out of range
QImage::pixel: coordinate (395,399) out of range
QImage::pixel: coordinate (396,399) out of range
QImage::pixel: coordinate (397,399) out of range
QImage::pixel: coordinate (398,399) out of range

Depending on the image, thousands of such messages are generated... Despite the error messages, the images are copied anyway, but the message flood is bothering my users. They're loosing other console feedbacks and such... Please, help. I can't force them to use square images.

0

There are 0 best solutions below