Results 1 to 4 of 4

Thread: QTreeView scrollTo when GUI is not done with painting all widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTreeView scrollTo when GUI is not done with painting all widgets

    Hi,

    I am using a QTreeView and want to jump to the last selected item at startup. This, unfortunately, does not work as I want it to, because the item is selected before the widget is painted and therefore, during the filling and reordering of the related QFileSystemModel, the selection moves out of the visible area. Any suggestions how to achieve the wanted behavior (i.e. the selection being in the view after the GUI is fully shown)?

    Thanks for help.

  2. #2
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView scrollTo when GUI is not done with painting all widgets

    Does no one have any experience with this? I would have guessed it is quite common to initialize a FileSystemBrowser with the last used structure, isn't it?

  3. #3
    Join Date
    Sep 2009
    Posts
    15
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView scrollTo when GUI is not done with painting all widgets

    Hi,

    Was looking around for a solution to this problem myself. (Wouldn't it be simpler just to have a flag you can set on the List or table view? ) Anyway, I googled and found a mention over on one of the Qt lists that pointed out that the problem is that the widget has to be visible before scrollTo works. My work around was to add a showEvent method and make the call there after calling, in my case, QDialog::showEvent. Seems to be working for now.

  4. #4
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView scrollTo when GUI is not done with painting all widgets

    thanks a lot, it works! (only I had to use PaintEvent because ShowEvent is delivered before the widget is shown)

Similar Threads

  1. Replies: 5
    Last Post: 18th April 2010, 23:31
  2. QDockWidget::title is painting over other widgets with QSS
    By edisongustavo in forum Qt Programming
    Replies: 0
    Last Post: 16th March 2010, 22:44
  3. QTreeView, Delegates and Persistent Widgets
    By chezifresh in forum Qt Programming
    Replies: 16
    Last Post: 16th December 2009, 09:30
  4. SQLITE QTableView scrollTo problem
    By vogeljh in forum Newbie
    Replies: 7
    Last Post: 16th April 2008, 19:45
  5. custom widgets painting image formats
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2007, 10:33

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.