[Qt-interest] connect()ing multiple buttons to a receiver
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Wed Jan 7 06:29:28 CET 2009
Paul wrote:
> To put this simply:
>
> I will have a few buttons (4 or 5) that I want to connect()
> to a single
> receiver.
> The receiver will behave slightly differently depending on
> what button
> is pushed though (does the same thing on different data).
>
> The buttons are stored in an array, and are made in a loop. How many
> depends on an
> environment variable. I can connect() them to the receiver
> just fine,
> but as they are in
> an array, the receiver doesn't know which one was pushed.
>
> From what I remember, reimplementing event handlers is a nono.
>
> Cheers
> Paul
Hi Paul,
Have a look at QButtonGroup. It can replace your array, and each button can
have an integer ID. The only drawback is it doesn't have clear(), if you
are creating the buttons multiple times.
Regards,
Tony Rietwyk
More information about the Qt-interest-old
mailing list