Results 1 to 4 of 4

Thread: Does sizeof() operator work with QT Objects?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Does sizeof() operator work with QT Objects?

    No. sizeof() returns size of the object, not its data.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Does sizeof() operator work with QT Objects?

    If you want to know the size of an image in bytes you load into a QImage and use its byteCount() method.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    leebandemaha (7th September 2013)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Does sizeof() operator work with QT Objects?

    Quote Originally Posted by anda_skoa View Post
    If you want to know the size of an image in bytes you load into a QImage and use its byteCount() method.
    However the size depends on the image format used and in most cases will be different than what size QPixmap occupies.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Dynamical objects (by operator new) in Qt
    By spherrra in forum Qt Programming
    Replies: 16
    Last Post: 10th October 2011, 21:06
  2. convert from QString to char[sizeof(...)]
    By adamatic in forum Qt Programming
    Replies: 4
    Last Post: 3rd September 2011, 10:05
  3. Sizeof wrong with structures ?????
    By tonnot in forum General Programming
    Replies: 11
    Last Post: 28th June 2011, 08:54
  4. Simple: Operator overloading with heap objects
    By durbrak in forum General Programming
    Replies: 12
    Last Post: 25th April 2007, 14:20
  5. which one is constant,sizeof(int) or sizeof(long)?
    By coralbird in forum Qt Programming
    Replies: 4
    Last Post: 20th March 2006, 12:01

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.