[Qt-interest] changing style of a QListViewItem
Andre Somers
andre at familiesomers.nl
Wed May 26 12:45:13 CEST 2010
On 26-5-2010 12:22, Nishant Sharma wrote:
> Thanks Andre.... even I was thinking of re-implementing PaintCell
> function... but again, how to make an item bold and underline ... ?
> Are there some font classes etc. which could be used ?
>
>
Did you check the documentation?
You paint using QPainter. QPainter has a series of overloaded drawText
methods, as well as a setFont method. setFont sets a QFont to use for
the drawText method. A QFont is a class that encapsulates a font, and
has a setBold and a setUnderline method, among many others. All that
from the documentation in less than three minutes...
André
> On Wed, May 26, 2010 at 3:29 PM, Andre Somers<andre at familiesomers.nl> wrote:
>
>> On 26-5-2010 11:43, Nishant Sharma wrote:
>>
>>> Thanks Mandeep and Andre.
>>> I am "him" :)
>>> Seems, you people are talking in terms of QT 4.x , but unfortunately,
>>> I'm using 3.3.6. Can you give some suggestion for 3.3.6 ?
>>>
>>>
>> Update?
>> Really, Qt 3 is outdated. Don't use it for new software.
>>
>> If you *must* use Qt 3, you're down to subclassing QListViewItem and
>> reimplementing it's paintCell method, if I remember correctly. I guess
>> you could add a method on your custom QListViewItem that you use to
>> toggle the flag that controls if it should be drawn in bold, and set
>> that from a slot connected to the QListView::doubleClicked() signal
>> after which you trigger an update.
>>
>> In the future, if you have a question on such an outdated version of Qt,
>> please mention the version explictly. People on the list (rightfully)
>> expect questions to be about a relatively recent Qt version. Qt 3 does
>> not count as recent, Qt 4.5 might...
>>
>> André
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
>
>
More information about the Qt-interest-old
mailing list