[Qt-interest] Multiple Button Problem
Ankit Agarwal
ankit17.ag at gmail.com
Fri Aug 26 07:11:57 CEST 2011
Thanks for all the suggestions.
QButtonGroup worked great for my scenario.
Thanks and Regards,
Ankit.
On Thu, Aug 25, 2011 at 2:35 PM, Tony Rietwyk <tony.rietwyk at rightsoft.com.au
> wrote:
> Hi Ankit, ****
>
> ** **
>
> Look at QButtonGroup: ****
>
> ** **
>
> - Use signal buttonClicked ( QAbstractButton * button ) to display the
> text. ****
>
> - And int id ( QAbstractButton * button ) const to get the id to use as an
> index into your list. ****
>
> - Include the index when you add the buttons to the group. ****
>
> ** **
>
> Beware that QButtonGroup has to be populated by code, as there is no visual
> for it to be used in Designer. ****
>
> ** **
>
> Tony****
>
> ** **
>
> ** **
>
> *From:* qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com[mailto:
> qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com] *On Behalf
> Of *Ankit Agarwal
> *Sent:* Thursday, 25 August 2011 5:20 PM
> *To:* Qt Interest (E-mail)
> *Subject:* [Qt-interest] Multiple Button Problem****
>
> ** **
>
> Hi,
>
> I am using Qt4.2.2 on Linux, Fedora14
>
> I have a QWidget which has 15 buttons. Each button has a different text on
> it. My requirement is that, whenever a user clicks on a button, I need to
> popup an QMessageBox and show that text in the message box.
>
> Secondly, I have QList with 15 quint32 counter items. Each item in the list
> corresponds to each button in the QWidget. So, whenever a user click on one
> of the button, the corresponding counter item in the list should be
> incremented by 1.
>
> One way is to write 15 different connect statements, one for each button.
> But, I believe there should be a better way of doing the same thing.
>
> Please suggest how can I achieve this.
>
> --
> Regards,
> Ankit Agarwal****
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
--
Regards,
Ankit Agarwal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110826/61f6b216/attachment.html
More information about the Qt-interest-old
mailing list