Results 1 to 2 of 2

Thread: How to pop up a MessageBox when QTableWidget row clicked

  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 How to pop up a MessageBox when QTableWidget row clicked

    How to pop up a MessageBox when QTableWidget row clicked?
    If a table has 2 rows, 5 columns.
    If I click on row 1, any column it has to pop up a Message box1 for that row regard less of column number clicked.
    If I click on row 2, any column it has to pop up a Message box2 for that row regard less of column number clicked.

    For row 1 I used
    QObject::connect(tableWidget_wmhData, SIGNAL(cellClicked(1,1)), this, SLOT(wmhID1())); //Where inside wmhID1 has QMessageBox funtionality to pop-up a Message.
    Similarly for row 2 , column 1
    QObject::connect(tableWidget_wmhData, SIGNAL(cellClicked(2,1)), this, SLOT(wmhVehID1()));

    Both these connect statements are implemented in Constructor.
    So With this type of implementation I am not able to pop-up a message?
    When I run application it say it give an error message:
    Error : Object::connect: No such signal QTableWidget::cellClicked(1,1)
    Object::connect: (sender name: 'tableWidget_wmhData')
    Object::connect: (receiver name: 'MainWindow')

    How to implement to get a pop-up Message Box1 as soon as click any cell for row1 ?
    Similarly for row2

    Thanks & Regards,
    Arun

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to pop up a MessageBox when QTableWidget row clicked

    First of all read this:

    http://www.qtcentre.org/forum/faq.ph...ot_with_values

    Second of all provide a custom slot where you will check which item was clicked and act accordingly.

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
  •  
Qt is a trademark of The Qt Company.