Is it possible to make the two widgets in a QSplitter of fixed size
I have a layout and QWidget and I have QSplitter with Vertical Orientation
QVBoxLayout *container_layout = new QVBoxLayout;
QWidget *container = new QWidget; container->setLayout(container_layout); d_verSplitter->setOrientation(Qt::Vertical); d_verSplitter->addWidget(container); d_verSplitter->addWidget(bottomWidget);
I want to make container and bottomWidget of fixed size . Is it possible to make to widgets addWidgets in QSplitter as fixed size
mvuori last edited by
Yes it is, as you probably already know by now, because adding the fixed size to your already existing widgets is a one-liner.
Out of curiosity, why use a splitter if you want to fixe the size of your widgets ?
It is requirement from our marketing and could you let me know what is that one liner code . because I do not know yet
So they basically want an unusable splitter ?
You would already have that answer by searching fixed in the documentation.
//creating two splitters d_horSplitter = new QSplitter; d_verSplitter = new QSplitter; /* creating the refresh button at the bottom*/ QWidget *bottomWidget = new QWidget; /* to make the refresh button as of fixed size*/ bottomWidget->setMaximumHeight(50); bottomWidget->setMinimumHeight(50); d_verSplitter->setOrientation(Qt::Vertical); d_verSplitter->addWidget(container); d_verSplitter->addWidget(bottomWidget);
and it is working .
<My question is that the correct way to do the same or is there a better to make the vertical splitter locked
setFixedHeightwould be cleaner.
It's the only solution I know but like I wrote: having a locked splitter is counter intuitive and will make your users pretty angry.