[Qt-interest] ui components

Ulf-Alexander v. Ceumern-Lindenstjerna ceumern at vrmagic.com
Thu Sep 17 14:27:31 CEST 2009


Here is what I use to paint a formatted string:

virtual void paint ( QPainter * painter, const QStyleOptionViewItem &
option, const QModelIndex & index ) const
{
// setup pen and brush and position painter
...
// use Qt basic HTML to format the string
QString formattedText = QString("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD
HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\"> ... ");
// use QTextDocument to draw the text
QTextDocument td;
td.setHtml(formattedText);
td.drawContents(painter);
}

HTH, Ulf

> -----Original Message-----
> From: Yuvaraj R [mailto:yuvaraj at ongobiz.com]
> Sent: Thursday, September 17, 2009 2:16 PM
> To: Ulf-Alexander v. Ceumern-Lindenstjerna
> Cc: qt-interest
> Subject: Re: [Qt-interest] ui components
> 
> Thanks for your reply
> 
> I don't exp the painting the string..
> 
> can u provide me,sample code to paint the string
> 
> 
> Please help me
> 
> 
> Thanks
> 
> Yuvaraj R
> 
> 
> 
> On Thu, Sep 17, 2009 at 5:39 PM, Ulf-Alexander v.
Ceumern-Lindenstjerna
> <ceumern at vrmagic.com> wrote:
> 
> 
> 	I suggest a QListView with a custom model and a custom item
> delegate.
> 
> 	See: http://doc.trolltech.com/4.5/model-view-programming.html
> 	And:
> 	http://doc.trolltech.com/4.5/qabstractitemdelegate.html
> 
> 	You'll have to do the painting yourself.
> 
> 	Regard, Ulf
> 
> 
> 	> -----Original Message-----
> 	> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> 	> bounces at trolltech.com] On Behalf Of Yuvaraj R
> 	> Sent: Thursday, September 17, 2009 12:45 PM
> 	> To: qt-interest
> 	> Subject: [Qt-interest] ui components
> 	>
> 	> Hi All
> 	>
> 	> can anybody say what are the components are involved in skype
> image
> 	>
> 	> I am trying to develop like skype image
> 	>
> 	> second image is mine
> 	>
> 	> i have used
> 	>
> 	> 1) text edit
> 	>
> 	> 2) text browser
> 	>
> 	> My problem is  how do set the string like in skype image
> 	>
> 	> please help me
> 	>
> 	> Thanks
> 	>
> 	> Yuvaraj R
> 
> 
> 





More information about the Qt-interest-old mailing list