Results 1 to 3 of 3

Thread: What does "pad" mean for QColor?

  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question What does "pad" mean for QColor?

    I'm reading the documentation of "Serializing Qt Data Types".
    I found that when serializing a QColor , QDataStream outputs the following things:spec,alpha,red,green,blue,pad.

    What does the pad value mean for a QColor? And what does pad mean for a real-life color?
    太极美术工程师师? ?•¿
    http://stupidbeauty.com/Blog

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: What does "pad" mean for QColor?

    See: http://qt.gitorious.org/qt/qt/blobs/...nting/qcolor.h

    I guess it is just nonsignificant "padding" to get the size of all alternative representations of color have the same number of bytes (see the unions in QColor class).

  3. #3
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What does "pad" mean for QColor?

    I have read the implementation of QColor. "pad" is just set to 0 in the constructors . So I think you are right.
    And I think the serialization of pad is not necessary . Is that right? It's always 0.


    Quote Originally Posted by mvuori View Post
    See: http://qt.gitorious.org/qt/qt/blobs/...nting/qcolor.h

    I guess it is just nonsignificant "padding" to get the size of all alternative representations of color have the same number of bytes (see the unions in QColor class).

    Added after 1 32 minutes:


    I just thought about it again. The serialization of pad is necessary. Because QDataStream is serializing the whole union , which is not always rgb. The explaination of the union depends on spec . Pad is not always 0.

    Quote Originally Posted by hxcan View Post
    I have read the implementation of QColor. "pad" is just set to 0 in the constructors . So I think you are right.
    And I think the serialization of pad is not necessary . Is that right? It's always 0.
    Last edited by hxcan; 28th December 2011 at 12:21.
    太极美术工程师师? ?•¿
    http://stupidbeauty.com/Blog

Similar Threads

  1. Replies: 1
    Last Post: 7th April 2010, 21:46
  2. Replies: 3
    Last Post: 15th February 2010, 17:27
  3. Replies: 3
    Last Post: 8th July 2008, 19:37
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.