[Qt-interest] remove QSplitter children / disable splitterdragging.

Thomi Richards thomir at gmail.com
Mon Nov 2 09:42:47 CET 2009


Hi,


2009/10/28 Ben Swerts <benswerts at telenet.be>:
> In that case a simple setParent(0) call on the widget removes it from the
> splitter without deleting it.
>


I've tried this, and it gives the same result as calling "hide()" on
the widget - yes, it is no longer visibly in the splitter, but the
splitter handle can still be dragged about, which just shows the
window background. Am I missing something here? The code I'm using to
remove the widget is this:

// stackedWidget is the widget I wish to remove / hide.
m_ui->stackedWidget->setParent(0);
m_ui->stackedWidget->hide();

And the code I'm using to re-add the widget to the splitter is similarly simple:

// splitter_2 is the QSplitter.
m_ui->splitter_2->addWidget(m_ui->stackedWidget);
m_ui->stackedWidget->show();


Am I missing something? I'd like to avoid creating my own
QSplitter-style class, but if it can't be avoided....


I note that there are several issues concerning this in the Qt
task-tracker (including one I submitted). Are any Trolls on this list
able to give us the official word on when this might be fixed? It's
obviously a feature that several people want to use (based on the
number of people on this list that have had the same problem and the
number of reported bugs in the task tracker), perhaps we could fix
this for the next Qt release?


Cheers,



More information about the Qt-interest-old mailing list