QImage and Warning C4267 'argument' : conversion from 'size_t' to 'int', possible loss of data?

  • I've done research on this warning and it seems common and pretty harmless. I was wondering if anyone had insight why the following line generates this warning? Also, how do I change it to make the warning to go away? I am assuming that col, row and step are causing this warning.

    QImage img(buffer, rgb.col, rgb.row, rgb.step, QImage::Format_RGB888);

  • Hello
    size_t is an unsigned int type so there might be an issue when you are dealing with large numbers (greater than 0x80000000). To get rid of that warning use a signed int.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.