On 04/04/2019 04:41, Ed Stokes wrote:
With reference to NETWORK_MESSAGE_HPP
Highlight Callsign In 13 quint32
* Id (unique key) utf8
* Callsign utf8
* Background Color QColor
* Foreground Color QColor
* Highlight last bool
*
How do I construct a QColor for this command sequence?
In particular, my language is Xojo <https://www.xojo.com>.
Thanks.
73, Ed
W1KOK
Hi Ed,
the Qt data stream format for QColor is defined here
https://doc.qt.io/qt-5/datastreamformat.html the document linked from
here
https://sourceforge.net/p/wsjt/wsjtx/ci/master/tree/NetworkMessage.hpp#l22 .
You need to follow the link to the QColor type to find the definition of
the color spec sub-field https://doc.qt.io/qt-5/qcolor.html#Spec-enum .
So in summary the QColor type is serialized as an unsigned 8-bit
discriminator that determines the meaning of the following values and
the following values are four 16-bit unsigned component values. The
values are followed by a 16-bit padding sub-field.
Using the Xojo BinaryStream type to build a suitable QColor value in
memory (as always in Big Endian network byte order) you might write:
' The Xojo Color type stores 8-bit per channel colour values
' so we can start with one of them and extend to the 16-bit
' per channel Qt's deep colour QColor type uses
'
' Let's start with a light green Color variable
Dim c As Color = &c007f00 ' Defaults to Alpha value 0
' Assuming os is a ByteStream instance set to BigEndian mode
' we write a serialized QColor version of light_green like this
os.WriteUInt8 (1) ' RGB spec
os.WriteUInt16 (c.Alpha)
os.WriteUInt16 (c.Red)
os.WriteUint16 (c.Green)
os.WriteUInt16 (c.Blue)
os.WriteUInt16 (0) ' padding
' To stream an invalid QColor value (needed to clear colours)
os.WriteUInt8 (0) ' Invalid spec
For i As Integer = 1 To 4
os.WriteUInt16 (0)
Next
73
Bill
G4WJS.
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel