You are not logged in.

1

Saturday, September 5th 2009, 7:08pm

Qlistview

hi everybody. i0m trying to create a program that may contain a qlistview, but i have a doubt, can i create an intem of qlistview where each line may contain a different font type?

for examble a listview where one item could be like this:

line 1 (font: arial black)
line 2 (font: times new roman)

line1 and line2 belong at the same item of qlistview.

Thanks.

zhnde

Beginner

Posts: 5

Location: de

  • Send private message

2

Saturday, September 5th 2009, 10:04pm

I'd like to use QListWidget + QListWidgetItem.

For QListView I don't know other way than to Inherit the QListView and reimplemente paintEvent with help of Delegate. See the example of Pixelator

3

Sunday, September 6th 2009, 3:19pm

thanks for the reply zhnde, if I use QListWidget + QListWidgetItem, i have to reimplement the paintEvent with help of Delegate, right?

I see the example of pixelator and i think that i have to do something similar, isn't it?

thanks for the reply.

zhnde

Beginner

Posts: 5

Location: de

  • Send private message

4

Sunday, September 6th 2009, 8:31pm

thanks for the reply zhnde, if I use QListWidget + QListWidgetItem, i have to reimplement the paintEvent with help of Delegate, right?


No, I mean alternative.
One is using QListWidget. You don't need to reimplemente anything. Because QListWidgetItem gives you the control on each item. But in this case you need to create two items with the same content but different fonts.
the Other is QListView, the base class of QListWidget. In paintEvent you can really draw two lines of string within one item in different fonts.

This post has been edited 4 times, last edit by "zhnde" (Sep 6th 2009, 9:17pm)


zhnde

Beginner

Posts: 5

Location: de

  • Send private message

5

Sunday, September 6th 2009, 8:39pm


I see the example of pixelator and i think that i have to do something similar, isn't it?
thanks for the reply.


yes, it's a example of QTableWidget. They work in the similar way.