Results 1 to 5 of 5

Thread: QTableView, slect a full row

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    12

    Default QTableView, slect a full row

    i want to select a whole row in a QTableView
    i have tried to parameterize the table view with

    setSelectionBehavior( QAbstractItemView::SelectRows );

    but still only the current QStandardItem is selected and not the full row, even if i use

    setCurrentIndex( oItem->index() );
    selectRow( oItem->row() );

    any clue ?

  2. #2
    Join Date
    Feb 2007
    Posts
    12

    Default Re: QTableView, slect a full row

    the problem is that i use a QItemDelegate to draw the first column and so i loose the highlight property applied to the second column. how to keep the background same on both columns ?

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

    Default Re: QTableView, slect a full row

    QItemDelegate is always used. You shouldn't lose any functionality if you apply a custom delegate to any column or row provided that your custom delegate knows how to draw items which are selected. Something else must be wrong. What data do you store in your items? What flags() do the items return? Is ItemIsSelectable among them?

  4. #4
    Join Date
    Feb 2007
    Posts
    12

    Default Re: QTableView, slect a full row

    i have tried many settings of the qtreetable but so far the problem i see is that if i use the method selectRow() and then clearSelection() with a qtableview setted for accepting a single selected item plus rows selection i cant unselect rows selected with selectRow() even by using clearSelection(). i have seen we can create our own selection behavior, i think i will try this way. still there are some bugs in qt atm about this, standard behaviors QAbstractItemView::SingleSelection and QAbstractItemView::SelectRows dont stack properly and if you use selectRow() you cant unselect the row later on, even with clearSelection()

  5. #5
    Join Date
    Feb 2007
    Posts
    12

    Default Re: QTableView, slect a full row

    i need to force by using resize to get only the full row selected (and not the other ones) even if this behavior was asked with QAbstractItemView::SingleSelection and QAbstractItemView::SelectRows.
    i have tried repaint and other refresh methods but only resize functions
    maybe a bug from my code, still sounds like a qt bug to me
    Last edited by titoo; 14th February 2007 at 10:49.

Similar Threads

  1. Set height of QTableView to fit exact number of rows.
    By Ben.Hines in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2019, 01:49
  2. QTableView sorting
    By gabriels in forum Qt Programming
    Replies: 11
    Last Post: 6th October 2010, 17:13
  3. QTableView currentChanged <> selecting header
    By Everall in forum Qt Programming
    Replies: 4
    Last Post: 1st April 2009, 08:24
  4. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 18:42
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49

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.