Results 1 to 3 of 3

Thread: How to identify working row in QTableView

  1. #1
    Join Date
    Apr 2010
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to identify working row in QTableView

    Hi All,

    There is a QTableView displayed for taking input from user on QWidgetalong with few buttons and drop-downs. There is a button to add rows in QTableView
    QTableViewis having 7 columns out of which one is QDateEdit(Col# 1), one is QComboBox(Col#4) and rest are QLineEdit. By default one row is displayed with all widgets set at their respective cells.

    My Requirment is :
    I want to disable QLineEdit at cell (x,2) if in QComboBox at (x,4) value "xyz" is selected.

    My Concern is :
    • I am not able to identify user has clicked QComboBox of which row.
    • Is there any in-buit function to get row number user is currently working ?


    Please help !!!
    Last edited by ronak.vashi; 9th December 2010 at 08:27.

  2. #2
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to identify working row in QTableView

    You can get the row number from the ModelIndex.

    But maybe you should take a look at the use of QItemDelegate to fine-tune the behaviour of a QTableView.
    It's really worth the trouble of learning the concept...

  3. #3
    Join Date
    Apr 2010
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to identify working row in QTableView

    Quote Originally Posted by boudie View Post
    You can get the row number from the ModelIndex.

    But maybe you should take a look at the use of QItemDelegate to fine-tune the behaviour of a QTableView.
    It's really worth the trouble of learning the concept...
    Can you paste few lines of code.....??? I tried using QModelIndex but didn't succeed.

    I have connected currentIndexChanged() signal to my own function while setting up QComboBox, but in that case also not able to identify which row's combo box is clicked.
    Last edited by ronak.vashi; 9th December 2010 at 10:01. Reason: updated contents

Similar Threads

  1. QTableView not working as expected.
    By junxuan in forum Qt Programming
    Replies: 7
    Last Post: 30th July 2009, 08:17
  2. QTableView doubleclicked event not working
    By sgmurphy19 in forum Qt Programming
    Replies: 6
    Last Post: 15th March 2009, 10:00
  3. QTableView ::setColumnWidth not working?
    By killerwookie99 in forum Qt Programming
    Replies: 2
    Last Post: 5th November 2008, 17:14
  4. identify QGraphicItem
    By avis_phoenix in forum Qt Programming
    Replies: 5
    Last Post: 24th September 2007, 06:16
  5. How to identify the process
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2007, 16: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.