Results 1 to 5 of 5

Thread: learn row of qtablewidget

  1. #1
    Join Date
    Mar 2011
    Posts
    23
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default learn row of qtablewidget

    i add pushbutton to qtablewidget with this code:
    Qt Code:
    1. ui->tableWidget->setCellWidget(currentRow,0,btn);
    To copy to clipboard, switch view to plain text mode 
    when i click the button how can i learn its row?
    ui->tableWidget->row(btn) does not work. because btn is not qtablewidgetitem

  2. #2
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: learn row of qtablewidget

    isn`t currentRow???

    I usually do this when adding an item to the table: first get the rowCount of the table, then add a row with that number...so that way you insert at the end and you know the rowNum to use it for future usage.

  3. #3
    Join Date
    Mar 2011
    Posts
    23
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: learn row of qtablewidget

    for example i have ten rows in my tablewidget and one button for each rows (total ten buttons).
    when i click button in fifth row, how can i learn row number?

  4. #4
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: learn row of qtablewidget


  5. #5
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: learn row of qtablewidget

    Here you go: link

Similar Threads

  1. how to learn QML?
    By zbj2012cn in forum Newbie
    Replies: 4
    Last Post: 25th July 2016, 09:26
  2. Help me for learn Qt.
    By Sparkle24 in forum Qt Programming
    Replies: 10
    Last Post: 9th May 2011, 09:04
  3. How to learn Qt
    By darrenbkl in forum Newbie
    Replies: 4
    Last Post: 11th April 2011, 20:16
  4. want learn c++ with qt
    By mohanakrishnan in forum Newbie
    Replies: 2
    Last Post: 14th October 2009, 08:15
  5. Replies: 1
    Last Post: 27th May 2009, 07:18

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.