Hallo all
I need to draw a graph (with nodes and edges) into a main window. To do this, I wrote a custom widget subclassing QLabel, and reimplementing the
|
Source code
|
1
|
void paintEvent(QPaintEvent*)
|
function. Everything goes fine, but I am unable to get the width and the height of the drawing area.
If I use the methods width() and height(), I get 100:30, even if I really don't understand where these values come from, since the size policy of my widget is set to Expanding, and it covers almost all the main window (when the window opens, the drawing area is almost 500x500, and it changes according to the resizing of the window).
Another question: is QLabel the right widget to subclass when I need to reimplement the paintEvent(), or there is some other widget more suitable ?
Thank you
Mtc