PDA

View Full Version : The problem about how to delete a widget in the QSplitter



cp
19th July 2013, 11:40
Hi everyone,
I have faced with a problem about the QSplitter.I have create a class inherited from QSplitter.I want this class can add or delete a widget dynamically.I know how to add a widget.But I don't know how to delete a wiget in the QSplitter.Do someone know how to do it?
Please help.
Thanks in advance.

Santosh Reddy
19th July 2013, 13:13
If you have handle of the widget just do a regular delete

delete widget;

If widget's handle is not available, then you can get the widget using QSplitter::index()


QSplitter * splitter;
int index;
...
QWidget * widget = splitter->widget(index);
delete widget;

cp
19th July 2013, 17:24
Thank you very much.The method you say works right to meet my need.