Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in manual or code in class painter #2494

Open
minduser00 opened this issue Jan 26, 2021 · 2 comments
Open

Errors in manual or code in class painter #2494

minduser00 opened this issue Jan 26, 2021 · 2 comments

Comments

@minduser00
Copy link
Contributor

minduser00 commented Jan 26, 2021

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.

@wodim
Copy link
Member

wodim commented Jan 26, 2021

drawChord for example has been buggy since forever as far as I can see

@wodim
Copy link
Member

wodim commented Jan 26, 2021

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)

minduser00 added a commit to minduser00/KVIrc that referenced this issue Jan 29, 2021
Restores parameters order as indicated in the manual for the functions of painter class:
   setFont, drawRoundRect, drawArc, drawChord and drawPie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants