[Qt-interest] Drawing rectangular

Yuvaraj R yuvaraj at ongobiz.com
Mon Sep 21 16:53:37 CEST 2009


Hi All


Can u please help how i paint the textbrowser Text ?


Thanks

Yuvaraj R




On Mon, Sep 21, 2009 at 7:34 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:

> Ya  you are correct..
>
> Just till now i am playing with sip side..
>
>
> Actually i am appending received chat messages in Text Browser..
>
> I want to set the  some background from from address like skype chat..
>
> like
>
> Yuvaraj
>
>  hi hello Qt
>
> That's why i am struggling..
>
>
> please help me
>
>
> Thanks
>
> Yuvaraj R
>
> On Mon, Sep 21, 2009 at 6:27 PM, Ulf-Alexander v. Ceumern-Lindenstjerna <
> ceumern at vrmagic.com> wrote:
>
>> I don't get it. If you already have a QTextBrowser, why do you want to
>> manually paint text onto it?
>>
>> QTextBrowser is made for displaying text and you should not have to paint
>> the text yourself.
>>
>> If you want to paint everything yourself just subclass a plain QWidget and
>> do everything by hand.
>>
>> Regards, Ulf
>>
>> Ps:
>> Also, I suggest you read a good book about Qt programming or do the online
>> tutorials, since your questions indicate that you have not done much work
>> with Qt yet and literature and the tutorials are always a good place to
>> start.
>>
>> > -----Original Message-----
>> > From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
>> > bounces at trolltech.com] On Behalf Of Yuvaraj R
>> > Sent: Monday, September 21, 2009 2:00 PM
>> > To: Samuel Rødal
>> > Cc: qt-interest
>> > Subject: Re: [Qt-interest] Drawing rectangular
>> >
>> > Thanks redal
>> >
>> > I am going towards my goal..
>> >
>> > I want to paint the paticular text of text browser..
>> >
>> >
>> > How can i acheive this one
>> >
>> >
>> > Thanks
>> >
>> > Yuvaraj R
>> >
>> >
>> > On Mon, Sep 21, 2009 at 4:17 PM, Samuel Rødal <sroedal at trolltech.com>
>> > wrote:
>> >
>> >
>> >       Yuvaraj R wrote:
>> >
>> >
>> >               still i am not getting
>> >
>> >               i am getting following things in log
>> >
>> >
>> >               QPainter::begin: Paint device returned engine == 0, type:
>> 1
>> >
>> >               QPainter::drawRects: Painter not active
>> >
>> >               QPainter::end: Painter not active, aborted
>> >
>> >               QPainter::setPen: Painter not active
>> >
>> >               QPainter::drawRects: Painter not active
>> >
>> >
>> >               Thanks
>> >
>> >
>> >               Yuvaraj R
>> >
>> >
>> >                  To call the base class paint event, your text browser
>> > class' paint
>> >                  event should look like this:
>> >
>> >
>> >                  void text_browser::paintEvent(QPaintEvent *e)
>> >                  {
>> >                         QTextBrowser::paintEvent(e);
>> >                         QPainter painter;
>> >                         painter.setPen(Qt::red);
>> >                         painter.drawRect(100,100,100,100);
>> >                  }
>> >
>> >                  I don't think calling accept() makes any difference for
>> > paint events.
>> >
>> >                  --
>> >                  Samuel
>> >
>> >
>> >
>> >
>> >       Right, that should have been QPainter painter(this); and not just
>> > QPainter painter;
>> >
>> >       But another problem is that QTextBrowser is an abstract scroll
>> > area, which means that its paint event actually paints into the
>> > viewport widget, not into the widget itself.
>> >
>> >       Try "QPainter painter(viewport());" instead.
>> >
>> >       Refer to
>> > http://doc.trolltech.com/4.5/qabstractscrollarea.html#details for more
>> > information on QAbstractScrollArea.
>> >
>> >       --
>> >       Samuel
>> >
>> >
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090921/cf6b7a50/attachment.html 


More information about the Qt-interest-old mailing list