Results 1 to 4 of 4

Thread: QTreeView unexpectedly updates on mouse movement (Win/Linux) or focus change (OSX)

  1. #1
    Join Date
    Jul 2013
    Posts
    7
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QTreeView unexpectedly updates on mouse movement (Win/Linux) or focus change (OSX)

    We have a QTreeView that is linked to a data model, but there is no datachanged() signal being expressly sent to a subclassed QTreeView. Nonetheless, it updates the view under certain circumstances. With Linux and Windows, it updates when the mouse moves across the widget. With Mac OSX it updates when the focus is changed.

    There is no logic in our subclass which follows the mouse movement or the window focus. Is this a bug in our software, a Qt bug, or a Qt feature which we simply aren't understanding?

    Here's a video of the behavior on Windows/Linux:

    http://youtu.be/1rVhB60VqBQ

    P.S. Using Qt 4.8.4.

  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: QTreeView unexpectedly updates on mouse movement (Win/Linux) or focus change (OSX

    Is this a bug in our software, a Qt bug, or a Qt feature which we simply aren't understanding?
    I would bet on option 1.

    It looks like something is changing the QItemSelectionModel of the view, not the model.

  3. #3
    Join Date
    Jul 2013
    Posts
    7
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeView unexpectedly updates on mouse movement (Win/Linux) or focus change (OSX

    Thanks for the tip. I went looking and found that we're using a subclass of QAbstractItemModel, but I assume that this would have the same effect.

    Is there any extra info you could add, such as the command itself that would be changing the model?

  4. #4
    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: QTreeView unexpectedly updates on mouse movement (Win/Linux) or focus change (OSX

    Anything in your code that touches QTreeView::setSelectionModel(), selectionModel() or subclasses QItemSelectionModel would be a suspect. If you do not replace the selection model of the view then this is unlikely to be the cause.

    If you have a totally hand-written model then it is also possible that the model's return for Qt::BackgroundRole is changing possibly without setData() emitting dataChanged() reliably.
    Last edited by ChrisW67; 21st July 2013 at 22:46.

Similar Threads

  1. QTextEdit mouse movement filtering
    By been_1990 in forum Qt Programming
    Replies: 18
    Last Post: 13th March 2021, 09:15
  2. How can QML understand mouse movement?
    By Yonetici in forum Qt Quick
    Replies: 5
    Last Post: 19th July 2012, 09:29
  3. about the mouse movement on the touchsceen LCD
    By huzl in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 9th March 2012, 13:45
  4. Forwrad & Backward mouse movement
    By sujan.dasmahapatra in forum Newbie
    Replies: 1
    Last Post: 28th October 2009, 06:54
  5. Game mouse movement
    By chaosgeorge in forum Qt Programming
    Replies: 1
    Last Post: 2nd December 2006, 23: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.