Results 1 to 5 of 5

Thread: QIconView refresh on returnPressed event

  1. #1
    Join Date
    May 2007
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QIconView refresh on returnPressed event

    I am debugging someone's code and I see a strange thing:
    - when double click-ing on the icon, the iconview is re-created, each of the new items is positioned as before
    - when pressing enter on an icon, the iconview is re-created, each of the new items is positioned as before and then the iconview is refreshed. The icons will expand to all the viewport space.

    And here's the problem: both doubleClick and returnPressed signals are triggering the same function, but the result is different. The idea behind positioning the icons is to have them represent a 2D matrix. Their spatial presentation matters and I would need a mechanism that places the icons within a specified boundary.

  2. #2
    Join Date
    May 2007
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QIconView refresh on returnPressed event

    This happens on Windows with 3.3.5 version of QT. Further debugging shows that eventFilter calls keyPressEvent and ensureItemVisible when the return key is pressed. The last function is responsible for arranging the items.

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QIconView refresh on returnPressed event

    So, isn't the same function called for a double click?

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QIconView refresh on returnPressed event

    Quote Originally Posted by calin_iaru View Post
    This happens on Windows with 3.3.5 version of QT. Further debugging shows that eventFilter calls keyPressEvent and ensureItemVisible when the return key is pressed. The last function is responsible for arranging the items.
    Maybe posting some code would help, and also explain a bit what the behavior should be.

  5. #5
    Join Date
    May 2007
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QIconView refresh on returnPressed event

    Actually I made a blog entry at this address:
    http://caliniaru.spaces.live.com/blo...BED0!138.entry

    If you don't want to read it, here's what I found so far:
    - returnPressed and doubleClicked are called from different contexts
    - in case of returnPressed, the redraw of the icons is done by the built-in timer. I have subclassed the QIconView and redefined slotUpdate in order to prevent the timer mechanism.

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.