Value ranges in QColor



  • Hi all,

    I want to enhance my qt5.natvis file for VS2013. I added a section as follows:

    <Type Name="QColor">
       <DisplayString Condition="QColor::Rgb  == cspec">{{ r={(ct.argb.red   * 255) / 65535} g={(ct.argb.green      * 255) / 65535} b={(ct.argb.blue      * 255) / 65535} }}</DisplayString>
       <DisplayString Condition="QColor::Hsv  == cspec">{{ h={(ct.ahsv.hue   * 359) / 65535} s={(ct.ahsv.saturation * 255) / 65535} v={(ct.ahsv.value     * 255) / 65535} }}</DisplayString>
       <DisplayString Condition="QColor::Cmyk == cspec">{{ c={(ct.acmyk.cyan * 255) / 65535} m={(ct.acmyk.magenta   * 255) / 65535} y={(ct.acmyk.yellow   * 255) / 65535} k={(ct.acmyk.black * 255) / 65535} }}</DisplayString>
       <DisplayString Condition="QColor::Hsl  == cspec">{{ h={(ct.ahsl.hue   * 359) / 65535} s={(ct.ahsl.saturation * 255) / 65535} l={(ct.ahsl.lightness * 255) / 65535} }}</DisplayString>   
    </Type>
    

    I want my debugger to show the color values within the valid range ( typ. [0..255] ). But as QColor stores the values in ushort format, I guess that the value ist scaled; i.e. 65535 in QColor stands for 255 in RGB code.
    So I want to know, if my assumption is correct.
    Thank's very much

    Sören


Log in to reply
 

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