Results 1 to 7 of 7

Thread: Display row Number in QMessageBox

  1. #1
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Display row Number in QMessageBox

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display row Number in QMessageBox

    What exactly is the problem (obtaining that number or displaying it)?

  3. #3
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Display row Number in QMessageBox

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display row Number in QMessageBox

    Quote Originally Posted by arunvv View Post
    How to add this row number at the end of this string as shown in above example.
    Use QString::number().

  5. #5
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Display row Number in QMessageBox

    Can I use QString::number() in QMessageBox. If so can you explain with the above shown QMessageBox Question string.

    Thanks & Regards,
    Arun.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display row Number in QMessageBox

    Quote Originally Posted by arunvv View Post
    Can I use QString::number() in QMessageBox.
    Yes, you can. Otherwise I wouldn't point you to it. What does this function do?

    Quote Originally Posted by arunvv View Post
    If so can you explain with the above shown QMessageBox Question string.
    No, because you will just copy and paste the code.

  7. The following user says thank you to jacek for this useful post:

    arunvv (1st May 2008)

  8. #7
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Display row Number in QMessageBox

    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.

Similar Threads

  1. Display only PNG image on desktop
    By durbrak in forum Qt Programming
    Replies: 32
    Last Post: 15th March 2008, 21:55
  2. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  3. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.