Results 1 to 6 of 6

Thread: QTreeView: mouse move on an item to highlight it as pre-selection

  1. #1
    Join Date
    Jul 2014
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTreeView: mouse move on an item to highlight it as pre-selection

    Hi,

    As pre-selection, when mouse move on an item in QTreeView, I want to raise the border of the item, but no solution yet. Any suggestion will be appreciated, thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView: mouse move on an item to highlight it as pre-selection

    You could overwrite the view's mouseMoveEvent() handler and use itemAt() to find the item you are currently at.

    There is also an entered() signal.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    jasonhxs (14th August 2014)

  4. #3
    Join Date
    Jul 2014
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView: mouse move on an item to highlight it as pre-selection

    Hi,

    Thanks, yes, I catch it, do you know how to raise the border of item in QTreeView?

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView: mouse move on an item to highlight it as pre-selection

    You can use a custom item delegate that draws differently if the cell is hovered over.

    Cheers,
    _

  6. #5
    Join Date
    Jul 2014
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView: mouse move on an item to highlight it as pre-selection

    Hi,

    I use style sheet with item hover setting, thanks.

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView: mouse move on an item to highlight it as pre-selection

    Ah, even simplier

    Cheers,
    _

Similar Threads

  1. Replies: 4
    Last Post: 23rd July 2013, 11:32
  2. Simulating item selection in QTreeView.
    By chandan in forum Newbie
    Replies: 4
    Last Post: 5th October 2010, 12:56
  3. QTreeView: Find nearest item to mouse pointer
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2009, 20:24
  4. QTreeView: selection behavior upon selected item removal
    By Pieter from Belgium in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2007, 16:00
  5. how to display full tree item name on mouse move ?
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 15th November 2006, 08: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.