PDA

View Full Version : Display row Number in QMessageBox



arunvv
1st May 2008, 21:17
Hi all,

I have QTableWidget which has 23 rows and 11 columns.
If I click on a particular row for QTableWidget, it has show a question QMessageBox.
Whenever the QMessageBox pops-up it has to display row number at the end of the Message string.

I am able to get QMessageBox pop-up whenever I click on a particlular row, but unable to display row number at the end of the message string.
How can I do it?

Thanks & Regards,
Arun.

jacek
1st May 2008, 21:36
What exactly is the problem (obtaining that number or displaying it)?

arunvv
1st May 2008, 22:38
My problem is how to get row number at the end of QMessageBox question Message string.

example: if(QMessageBox::question(tableWidget_wmhData, "Remote ID ",
"See detailed view for ID- ",
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes)

After "See detailed view for ID-", I need to display row number end of this string next to "ID-" .
I am using tableWidget_wmhData->currentRow() for the current Row number. How to add this row number at the end of this string as shown in above example.

Thanks & Regards,
Arun.

jacek
1st May 2008, 22:40
How to add this row number at the end of this string as shown in above example.
Use QString::number().

arunvv
1st May 2008, 23:57
Can I use QString::number() in QMessageBox. If so can you explain with the above shown QMessageBox Question string.

Thanks & Regards,
Arun.

jacek
2nd May 2008, 00:05
Can I use QString::number() in QMessageBox.
Yes, you can. Otherwise I wouldn't point you to it. What does this function do?


If so can you explain with the above shown QMessageBox Question string.
No, because you will just copy and paste the code.

arunvv
2nd May 2008, 00:24
Thanks for you reply. You are right, if you would have shown a piece of code, I would have just copied and make it work. Now I studied on this actually works,
I got cleared and came to know how it works.

I changed the QMessageBox to
...
...
row = tableWidget_wmhData->currentRow();
if(QMessageBox::question(tableWidget_wmhData, "Remote ID ",
"See detailed view for ID- " + QString::number(row),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes)

I will remember this usage of QString Number in QMessageBox forever.

Thanks & Regards,
Arun.