Results 1 to 4 of 4

Thread: Problem refreshing QTreeView inside QTabWidget

  1. #1
    Join Date
    Aug 2009
    Posts
    23
    Thanks
    3

    Default Problem refreshing QTreeView inside QTabWidget

    Hi everybody,

    I encounter a strange behaviour with my application.
    I do have a QTabWidget which have 4 tabs. Each of those tabs contain a QTreeView. Those 4 QTreeView use the same source model but different proxy model.

    When rows are added to the source model, the current tab and therefore the corresponding QTreeView is not ... repaint I would say?
    I said it is a strange behaviour because I am able to select the row in the QTreeView and I am even able to drag an drop this row even if it is not visible.
    The rows become only visible when I resize the widget containing the QTabWidget.

    Anybody has already faced this problem or knows what I am doing wrong?

    Best Regards,
    Lionel

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem refreshing QTreeView inside QTabWidget

    Are you using QAbstractItemModel::dataChanged after adding data to the source model ?

  3. #3
    Join Date
    Aug 2009
    Posts
    23
    Thanks
    3

    Default Re: Problem refreshing QTreeView inside QTabWidget

    I use QAbstractItemModel::reset() when rows are added.

    I noticed that when I add enough rows, which requires a scrollbar, the rows are visible.
    I believe the scrollbar calls a repaint.

    The rows added are also visible when I add rows to a QTreeView which already contains at least one row.

    Rows are invisible only when they are added to en empty QTreeView. Is it related to the use of QAbstractItemModel::reset()?

    Thanks for helping me,
    Lionel

  4. #4
    Join Date
    Aug 2009
    Posts
    23
    Thanks
    3

    Default Re: Problem refreshing QTreeView inside QTabWidget

    Hi,

    I had time to investigate a little further.
    As I noticed before if I force a resize of the QWidget containing the QTabWidget, the new row will appear.

    I also forgot to say that I use an item delegate for the QTreeView. My first thought was that I did not paint anything or the QPainter was invalid the first time I use it. But unfortunately, this is not the case. It seems to paint everything but nothing appear on screen.

    If anybody has a clue, it would relieve me!

    Regards,
    Lionel

Similar Threads

  1. Problem with index in a QTreeView
    By hubert_p in forum Qt Programming
    Replies: 4
    Last Post: 22nd October 2006, 15:54
  2. Selection problem in QTreeView
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 7th October 2006, 16:02
  3. QTabWidget - problem with resizing
    By moowy in forum Qt Programming
    Replies: 5
    Last Post: 14th September 2006, 14:06
  4. Refreshing problem
    By jaime in forum Qt Programming
    Replies: 3
    Last Post: 24th August 2006, 22:09
  5. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59

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.