Results 1 to 3 of 3

Thread: QItemDelegate highlight row

  1. #1
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Question QItemDelegate highlight row

    Hello,

    I have implemented my own QItemDelegate for items in one column of a QTreeView.
    Now what is missing is the code to highlight the whole row when the mouse is somewhere above the row.

    The selection stops when my delegate starts and i need it to continue with the same style as before (see attachement).
    line.PNG

    Anybody already tried this?


    I hope somebody can help me.

    Thank you in advance.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QItemDelegate highlight row

    it is not clear what you are asking and your picture, showing everything shaded in some way, does not help much.

  3. #3
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: QItemDelegate highlight row

    Never mind,

    found the solution by making sure to copy all parameters from the paint call to drawPrimitive befor doing the rest of my drawing.

    Qt Code:
    1. void myDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
    2. {
    3. ...
    4. QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
    5. ...
    6. //Do my drawing
    7. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Highlight Sentence
    By arumita in forum Newbie
    Replies: 1
    Last Post: 23rd May 2014, 11:55
  2. Highlight row in treeview
    By supergillis in forum Qt Programming
    Replies: 6
    Last Post: 20th November 2008, 09:49
  3. QItemDelegate
    By Alex_123 in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2008, 12:40
  4. Using most of QItemDelegate
    By joshuajcarson in forum Qt Programming
    Replies: 4
    Last Post: 6th October 2008, 17:02
  5. QItemDelegate
    By cyberboy in forum Qt Programming
    Replies: 10
    Last Post: 27th June 2008, 18:41

Tags for this Thread

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.