PDA

View Full Version : making sure all qgraphicsview widgets are of the same size in hlayout



Algos
13th March 2016, 22:07
I am displaying a set of images side by side in a horizontal row in an hlayout in my mainwindow.

Basically, I have a horizontal layout and just add the qgraphicsview with pHLayout->addWidget(pImgView[n]), for n = 0, 1, 2 and 3, thus displaying a set of four images in a single horizontal row. I don't do any layout formatting.

Now, I have a zoom class implemented that I use to zoom in/out of one grahics view such that all graphics views zoom in sync (thanks to d_stranz (http://www.qtcentre.org/threads/61170-display-mutliple-images-and-sync-viewing?p=270594#post270594)).

So far so good.

The problem is that I added functionality to choose to hide/show any or all of these images. When I hide() one (or more) and then show() them back, they do not have the exact same size and my zooming breaks.

Ideally, I would like to have all the displayed graphics views to have the exact same size in the hor. layout. Suggestions on how I can enforce this?

Thanks.