prevent "monster paintEvent - method"
Verfasst: 9. Juni 2009 22:35
Hello,
to paint, qtjambi uses the paintEvent method.
i would like to write a little cartesian coordinate plane to display some charts.
there should be the option to
set the x- and y-axes visible/invisble
set the marks of the axes visible/invisble
set a legend visible/invisble
set a gray grid of helplines visible/invisble
change the background color
change the scaling
now i am afraid that the paintEvent will be a monster with tons of "if else"
if(showXAxis){
myQPainter.doThis()
}
if(showHelplines){
myQPainter.doThat()
}
is there a way to keep paintEvent small and clearly??
and i ask myself how different classes can paint on the canvas?
is it possible to calculate the hundrets of points of a chart in a different class, that just passes a "painting object" to the canvas?
like a small painting application with one canvas and some buttons.
one button "paint Rectangle"
one button "paint Circle"
one button "paint Star"
...
a class CalculateTheCircle should calculate and pass just a circle to the canvas ..
thanks for any hint
beste gruesse
jochen
to paint, qtjambi uses the paintEvent method.
i would like to write a little cartesian coordinate plane to display some charts.
there should be the option to
set the x- and y-axes visible/invisble
set the marks of the axes visible/invisble
set a legend visible/invisble
set a gray grid of helplines visible/invisble
change the background color
change the scaling
now i am afraid that the paintEvent will be a monster with tons of "if else"
if(showXAxis){
myQPainter.doThis()
}
if(showHelplines){
myQPainter.doThat()
}
is there a way to keep paintEvent small and clearly??
and i ask myself how different classes can paint on the canvas?
is it possible to calculate the hundrets of points of a chart in a different class, that just passes a "painting object" to the canvas?
like a small painting application with one canvas and some buttons.
one button "paint Rectangle"
one button "paint Circle"
one button "paint Star"
...
a class CalculateTheCircle should calculate and pass just a circle to the canvas ..
thanks for any hint
beste gruesse
jochen