[Qt-creator] What is the correct way of removing UI elements with code ?

Coda Highland chighland at gmail.com
Wed Oct 10 19:14:44 CEST 2012


On Wed, Oct 10, 2012 at 9:59 AM, Murphy, Sean M. <sean.murphy at gd-ais.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 ?
>> >
>>
>> Two things.
>>
>> (1) This is a question for qt-interest; this list is for issues
>> concerning the IDE itself, not the toolkit.
>
> This may not be a question for qt-interest.  I think he's asking the question:
>
> "I thought I was going to need a QPushButton in my code, so I put one in, and started connecting its signal to slots all over my code.  Now I've refactored and decided I no longer need that object.  Is there a simple way to remove all references to it in my code using some Qt Creator functionality?"
>
> So I think maybe he's asking if there's similar functionality to "find all references" that is "remove all references"?
>
> Sean

Ah, good catch, I hadn't considered that interpretation, and that is a
much more relevant topic.

I wouldn't WANT to see "remove all references", though; doing that in
an automated way is sure to cause problems. "Find all references" on
the other hand IS a good approach to at least get started at it.

/s/ Adam



More information about the Qt-creator mailing list