PDA

View Full Version : Model/QTreeview sometimes doesn't draw



winkle98
22nd November 2011, 03:44
I have a QTreeview that's hooked to a model that manages data from an in-house data object.

In the model I have a list of QTreeViewItems which I basically use to keep track of parent and child counts and nodes.

The problem is..if I open a project that already contains data the tree displays that information. However, if I start the application and the first thing I do is create a project, when I create the first data entry, nothing is displayed. I never hit the paint method for my delegate. My proxy model's filterAcceptsRow is returning true as expected. I just don't ever hit the paint method in my delegate. I've checked the row and column count and the data is being added and the rowCount menthod on my model is returning 1 as expected. The only thing I can think of is there is something I'm missing in the setup that only has an affect only in this case. Has anyone run into this issue?

FYI: Here are the cases I'm seeing.

1) Start app; open project with data; data displays; close project and create new project; data displays.

2) start app; create project; NO data displays; open project with data; no data displays.

Basically, the behavior is different depending on whether the first thing I do is open an existing/populated project or create a new project.

winkle98
22nd November 2011, 05:56
Still debugging and what I noticed is that, in the case where I create a project:

I use a QDialog to enter the new data for my project. I dismiss this dialog and then attempt to resize the application, it doesn't redraw my QTreeView. It draws bits of the dialog I just dismissed.

The basic structure of the app is that it's a QMainWindow with a menubar, toolbar, and statusbar. The treeview is the central widget.

Does this offer up any clues as to what I've done wrong.

winkle98
22nd November 2011, 21:57
After looking further into the drawing issues when I resize the application's window it appears to be a painting issue. I haven't fixed that yet, but the model view issue is off the table.