PDA

View Full Version : user resize QGroupBoxes size dynamically with the mouse



fatecasino
31st March 2011, 18:02
In Qt Creator and many other applications which contain a lot of tools the user can resize with the mouse the size of each docked window. Is it possible to do the same with QGroupBox? For example I have a QVBoxLayout with 2 QGroupBoxes. Is it possible to let the user decide the size of each QGroupBox as he desires?
Thanks!

ChiliPalmer
3rd April 2011, 13:54
There are several ways.
If it's only the two QGroupBoxes you could put a QSplitter (http://doc.trolltech.com/4.7/qsplitter.html) between them.
To make the QGroupBoxes resizeable individually for more complex grid structures would mean quite a bit of work.

JohannesMunk
3rd April 2011, 17:00
Small correction: In Qt you need to add widgets to a splitter. Not put a splitter between them, like for example in Delphi. The splitter will replace a vertical or horizontal layout depending on its orientation.

Joh

fatecasino
4th April 2011, 23:21
QSplitter is just fantastic!!
it just did the job :)
I added 2, one horizontal and one vertical and both work great.
thanks!

fatecasino
7th February 2012, 01:00
coming back to solve a small bug :)
I used QSplitter successfully but I have a little problem..
I cannot see the handles!
I have to guess their position by moving the mouse over the area.

ChrisW67
7th February 2012, 01:50
Appearance is governed by the style in use, which generally mimics the platform's native look and feel by default. You are free to style the splitter or even provide a custom QSplitterHandle.

fatecasino
7th February 2012, 03:03
Thanks! I did it. I actually added an image on the handle



QApplication app(argc, argv);
app.setStyleSheet("QSplitter::handle { background-color: grey }");
app.setStyleSheet("QSplitter::handle { image: url(images/ss.png) }");