QTreeView setFirstColumnSpanned?

Linus Torvalds torvalds at linux-foundation.org
Sat Jun 8 18:09:58 PDT 2013


Here's a question to the Qt people out there: exactly how/where would
you use setFirstColumnSpanned() to make the trips look saner?

Right now, we have the trip entries in the dive list look exactly like
the dives themselves, and I find it annoying. There's all that stupid
whitespace for the fields that really don't make much sense for trips,
like the dive number, or the duration field.

And though some of the other columns *might* be sensible for trips (ie
I could see a trip star rating or "max depth" or whatever in
*theory*), in practice they are unlikely to ever really make sense
either, so in the end a trip really only has two fields: location and
date.

Now, we actually have a third field for trips ("notes") that might be
worth showing too if we had more space due to not showing the other
things, so I think that we *could* have three fields, but the point is
- the fields aren't the same as for dives.

Which made me go "can a QTreeView have different representations for
different rows". And yes, indeed, there's that setFirstColumnSpanned()
thing. Not perfect, but I think it's better than what we have now. But
I don't see a where to actually do that: when we create the trip entry
in the model, we have the *model*, but not the QTreeView.

So hey, let's ask the Qt guys - how would you make trips have just
that one first field, and then just print both date and location in
that field? And how would you make it line up sanely since
setFirstColumnSpanned() doesn't seem to support having two fields and
the date string isn't fixed-width?

                Linus


More information about the subsurface mailing list