Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage and Warning C4267 'argument' : conversion from 'size_t' to 'int', possible loss of data?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jh224
    wrote on last edited by
    #1

    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);
    @

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Buckets
      wrote on last edited by
      #2

      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.

      ba ba ba
      ba na na na

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved