[Qt-creator] What is the correct way of removing UI elements with code ?
chighland at gmail.com
Wed Oct 10 17:38:46 CEST 2012
On Wed, Oct 10, 2012 at 7:51 AM, Patryk Małek <malekpatryk at gmail.com> wrote:
> I have just encountered a problem, where I do not need a certain UI element
> e.g. QPushButton and I would like to remove it but since I have connected it
> with several slots (e.g. clicked(), released() etc. ) I now have several
> references of this button in my code.
> How can I remove all of this efficiently ? Do I have to remove it all
> manually ?
> kind regards,
> Patryk Małek
> Qt-creator mailing list
> Qt-creator at qt-project.org
(1) This is a question for qt-interest; this list is for issues
concerning the IDE itself, not the toolkit.
(2) If signal connections are the only references you have, there's no
concern -- QObjects (QPushButton is one, of course) disconnect
themselves from everything automatically on delete. If you have other
pointers hanging around, consider QPointer; this is Qt's smart pointer
class that automatically zeroes itself when its referent is deleted.
More information about the Qt-creator