PDA

View Full Version : My Qgraphicsview widget is not resized by the vertical splitter which has control.



tonnot
5th September 2011, 18:53
I have a verticalsplitter with to elements. One has the Vstrech to 1 and the lower to 3.
Initially I have a standar widget promoted to a 'my_drawer' widget. This had the paint event overloaded, nothing more. All worked fine. The verticalsplitter assigned the correct heigths'
Ok, now this 'my_drawer' widget is qgraphicsview based. I have deleted the paintevent and write a drawbackground, nothing more.

Ok, I dont know why is the reason because now the vertical splitter does nothing. My qgraphicswidget has 30 pixels of height.....
Any idea ?

wysota
5th September 2011, 20:28
Please provide a minimal compilable example reproducing the problem.

tonnot
6th September 2011, 07:20
Here you are.
The Vsplitter has 2 widgets , top widget has svtrech = 1, bottom widget has vstrecht = 3.
The bottom widget is promoted to a agraph ( a simple widget with Qgraphicsview inheritate)
As you can see when run, something is wrong. There is no 1/3 relation .
You only need to denote the widget_2 and you see the splitter working fine.
Any idea ?

wysota
6th September 2011, 08:52
What sense does it make to use QSplitter with relative widget sizing? If you just want initial sizes to be set, use QSplitter::setSizes(). Indeed splitters misbehave a bit when layout facilities are applied to them.

tonnot
6th September 2011, 10:26
mmm
I dont understand what you want to tell me....
I thought that it was sufficient to set the strech values.
I only want to have 25 and 75 % for each widget....
Then, Is it a bug ?

Thanks for your time.

wysota
6th September 2011, 10:29
I only want to have 25 and 75 % for each widget....
So remove the splitter and use a normal vertical layout.

tonnot
6th September 2011, 10:36
Excuse me.... I also want the user can change the size if he wants.
So, finally, as you said,

Indeed splitters misbehave a bit when layout facilities are applied to them.
it can be a bug ?

wysota
6th September 2011, 11:01
So you don't want to have 25% and 75%. You want initial sizes to be that, so use QSplitter::setSizes() as advised. Yes, it's a bug if you ask me but it has been there since ever, so I guess it is either not fixable or they don't consider it a bug.