PDA

View Full Version : Problem refreshing QTreeView inside QTabWidget



laugusti
24th November 2009, 17:20
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

aamer4yu
25th November 2009, 04:33
Are you using QAbstractItemModel::dataChanged after adding data to the source model ?

laugusti
25th November 2009, 11:08
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

laugusti
16th December 2009, 09:05
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