[Qt-interest] Multiple Button Problem
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Thu Aug 25 11:05:16 CEST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110825/8a60fa0d/attachment.html
More information about the Qt-interest-old
mailing list