[Qt-interest] How to delete the widget from the stack in Qt

Ramesh ramesh.bs at robosoftin.com
Wed Mar 24 12:22:34 CET 2010


Oh.. ok

Thank you very much.. i will do as you suggested      

 

From: Denis Akhmetzyanov [mailto:dakhmetzyanov at smartlabs.tv] 
Sent: Wednesday, March 24, 2010 4:40 PM
To: Ramesh
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] How to delete the widget from the stack in Qt

 

Hi, 

Documentation of QStackedWidget::removeWidget() has slightly confusing note:

   Note: The ownership of widget remains the same.

But implementation of QStackedWidget simply delegates removing to the
internal QStackedLayout:

 

void QStackedWidget::removeWidget(QWidget *widget)

{

    d_func()->layout->removeWidget(widget);

}

 

And description of the QLayout::removeWidget() says:

   Note: The ownership of widget remains the same as when it was added.

Therefore you should take ownership of the removed widget to yourself and
delete it manually. For example:

 

// QWidget *widget

stackedWidget->removeWidget(widget);

delete widget;

 

P.S. Documentation of Qt 4.6

 

 

2010/3/24 Ramesh <ramesh.bs at robosoftin.com>

Hi, i am using Qstackedwidget to switch between the views, i will be able to
traverse between the views, i am facing problem in some scenario, where i do
not require the widgets, i want to remove them completely.. stackedwidget
provides the functionality to removewidgets, still the ownership of the
widget will be there, i mean widget will be hidden.

i dont want this to be happen, when i call remove widget the widget should
be deleted. how to handle this?

Thanks

 

-----------------------------------------------

Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an
intended recipient, please notify the sender and delete all copies. Emails
to and from our network may be logged and monitored. This email and its
attachments are scanned for virus by our scanners and are believed to be
safe. However, no warranty is given that this email is free of malicious
content or virus.

 


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

 


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100324/7cfa8e54/attachment.html 


More information about the Qt-interest-old mailing list