Primary tabs

AUG
4
2006

Qt4 ItemViews

Comments

QTree is too complex (API wise) and it still is impossible to alter the header to look like the qlistview headers which were not whole width. (probably a bug).

All 3 view classes seem overdesigned compared to other toolkits, though.


By Thomas Zander at Sat, 08/05/2006 - 21:44

there was quite a bit of code that was introduced for the sake of design patterns. the model view stuff is better than nothing, but it was over engineered and quite painful to use beyond simple table based database views. Ideally the trolls will figure out how to recover the design and make it usable for more generalized use.


By Ian Reinhart Geiser at Sun, 08/06/2006 - 18:41

I am not sure what you mean, the ListView doesn't have any headers.


By Benjamin Meyer at Sun, 08/06/2006 - 22:40

* start Qt3 Designer
* insert a "List View" (Tools->Views->ListView)
* see the "Column 1" thing at the top. Thats what I call a header.

And notice how it is not full width. This seems to be impossible to do with Qt4.


By Thomas Zander at Mon, 08/07/2006 - 09:24

If you turn off stretching last section you will get what you are looking for.

view->header()->setStretchLastSection(false);


By Benjamin Meyer at Tue, 08/08/2006 - 10:39

What I'd like is for the wrapper classes to be less shit. Eg. You can insert a string at a specific position of a QListWidget using insert( int, QString ) but there's no way to get it out again without doing a dance with QListWidgetItem. With tree views it's worse.


By Richard Moore at Mon, 08/07/2006 - 09:04

From looking at the docs I would think you should be able to do:

listWidget->insertItem(10, "foo");
delete listWidget->takeItem(10);

Are you thinking of something else?


By Benjamin Meyer at Mon, 08/07/2006 - 09:38

Yeah I'm thinking of something else. I'd like to be able to go:

listWidget->insertItem(10, QString("Foo") );

Then later:

QString s = listWidget->itemText( 10 );

I'd also like a set of corresponding signals as we had in Qt 3.x.


By Richard Moore at Mon, 08/07/2006 - 10:19

listWidget->insertItem(10, QString("Foo") );
QString s = listWidget->item(10)->text();

Many of the signals such as the selectionChanged() are now in the QItemSelectionModel


By Benjamin Meyer at Mon, 08/07/2006 - 22:14

The trouble with that is that you have to search through the docs for the model-view classes - exactly what the wrapper is supposed to avoid. The wrapper should be usable on its own IMHO, and currently it is not. There's also the issue of the non-orthoganal API - you can set the text directly but not get it back.


By Richard Moore at Tue, 08/08/2006 - 08:36

Pages