KVIrc
KVIrc copied to clipboard
Errors in manual or code in class painter
I found in the manual errors in the order of the parameters of four functions of the painter class.
In the function $setFont the help says from line 302 of file src/modules/objects/KvsObject_painter.cpp
!fn: $setFont(family:string,size:integer[,style:enum,style:enum,..])[br]
Set the font's family, size and style, valid flag for style are:[br]
the same as in class widget but in the code the order says:
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("size", KVS_PT_INTEGER, 0, iSize)
KVSO_PARAMETER("family", KVS_PT_STRING, 0, szFamily)
KVSO_PARAMETER("style", KVS_PT_STRINGLIST, KVS_PF_OPTIONAL, szListStyle)
KVSO_PARAMETERS_END(c)
this was introduced in dbaac33
Maybe the correct solution is to change the order of the parameters to this function, so that the two classes widget and painter would have a setFont function with the same order of parameters.
The same occurs with the following three functions: $drawPie(<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>,angle:integer,alen:integer) $drawArc(<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>,angle:integer,alen:integer) $drawChord(<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>,angle:integer,alen:integer)
in the code the order of the three is: (angle:integer,alen:integer,<x:integer>,<y:integer>,<w:unsigned integer>,<h:unsigned integer>)
I don't know when the order of the parameters of these last three was changed, the Grifisx/Noldor scripts used the order indicated in the manual, so the code was changed at some point.
drawChord for example has been buggy since forever as far as I can see
The correct solution indeed is to fix the code, not the docs, as the code adheres to the Qt api generally. For example:
void drawPie(int x, int y, int width, int height, int startAngle, int spanAngle)