PDA

View Full Version : qsplitter



marc2050
31st May 2011, 12:47
Hi.

When I created a vertical splitter with 5 splits.
Everytime my mouse hover over the edge of the splits, there is change in the mouse pointer and I could adjust the size of the splits. How do I disable that? I just want fixed size and no change to the sizes.
Another question is, when I created a button in one of the splits. the button always left align. How do I make it centre aligned? There dont seem to be a align function somewhere.

Thanks!

SixDegrees
31st May 2011, 13:00
The whole point of a splitter is to allow resizing. If you don't want the user to resize the layout, just use a layout that enforces the geometry you want to impose.

While you're doing that, read up on the details of layouts, as they're the answer to your second question.

marc2050
31st May 2011, 14:42
Thanks.

I did this codes:
QVBoxLayout *vBox3 = new QVBoxLayout();
vBox3->addWidget(mywidget1);
vBox3->addWidget(mywidget2);

But how do I encapsulate this layout into a kind of a widget so I could add them?
I cannot put vBox3 as the widget parameter. I tried QGroupbox and it worked.
But I dont want QGroupBox. Is there something similar to such encapsulating function to make the vBox3 into a widget?

Santosh Reddy
31st May 2011, 17:06
I guess you are looking to add a layout to a widget


QWidget* widget = new QWidget();

QVBoxLayout *vBox3 = new QVBoxLayout();
vBox3->addWidget(mywidget1);
vBox3->addWidget(mywidget2);

widget->setLayout(vBox3); // adds the layout to the widget