1

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.

Paulo Carvalho
  • 554
  • 5
  • 10
  • If you set the image width to 399, you should only be accessing pixels 0 to 398 so you are causing an error yourself if you access pixel 399. – Mark Setchell Feb 14 '16 at 19:21
  • I think I wasn't clear. Please, try the code example. Set the dimensions to 399, 400 instead of 400, 400. Of course I know the range is 0-398. But if you read the code, I'm not trying to access any element beyond the allowed range. The error is triggered internally. – Paulo Carvalho Feb 16 '16 at 00:14

0 Answers0