Qt-interest Archive, July 2007
writing on qt form
Message 1 in thread
hi,
In VB we can use Form.print to write some text directly on form. In qt-3.1 are
there any API's to satisfy this condition without using any label.
Thanks and Regards,
Niranjan
--
[ signature omitted ]
Message 2 in thread
With Qt4 you can use QPainter::drawText() .. I am not sure if there is a
Qt3 equivalent ...
Regards,
Malte
--
[ signature omitted ]
Message 3 in thread
Malte Witt wrote:
> With Qt4 you can use QPainter::drawText() .. I am not sure if there is a
> Qt3 equivalent ...
>
It does also exist in Qt3
http://doc.trolltech.com/3.3/qpainter.html#drawText
regards,
Andre
--
[ signature omitted ]
Message 4 in thread
hi,
i used
QPainter p1;
p1.drawText(200,100,"aaaaaaaaaaaaaaaaaa",8,QPainter::LTR);
in focusInEvent of form, but text is not showing on form,
can u tell me what's the wrong????
Thanks and Reagrds,
Niranjan
On Tuesday 17 July 2007 15:59, Andre Haupt wrote:
> Malte Witt wrote:
> > With Qt4 you can use QPainter::drawText() .. I am not sure if there is a
> > Qt3 equivalent ...
>
> It does also exist in Qt3
>
> http://doc.trolltech.com/3.3/qpainter.html#drawText
>
>
> regards,
>
> Andre
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 5 in thread
> in focusInEvent of form, but text is not showing on form,
>
> can u tell me what's the wrong????
Yes I can:
IIRC, you can only do what you want in the paintEvent() of the Widget.
The example from the docs:
void SimpleExampleWidget::paintEvent()
{
QPainter paint( this );
paint.setPen( Qt::blue );
paint.drawText( rect(), AlignCenter, "The Text" );
}
http://doc.trolltech.com/3.3/qpainter.html#details
Regards,
Malte
--
[ signature omitted ]
Message 6 in thread
hi,
Thnaks, now its working fine in paintEvent.
There is void setBackgroundColor ( const QColor & c ) of qpainter but what
abt foreground color, if i want to set foreground color to text.
There is no API related to foreground color of qpainter..
Can u tell me plz how to do this
Thanks and Regards,
Niranjan
On Tuesday 17 July 2007 16:36, Malte Witt wrote:
> > in focusInEvent of form, but text is not showing on form,
> >
> > can u tell me what's the wrong????
>
> Yes I can:
> IIRC, you can only do what you want in the paintEvent() of the Widget.
>
> The example from the docs:
>
> void SimpleExampleWidget::paintEvent()
> {
> QPainter paint( this );
> paint.setPen( Qt::blue );
> paint.drawText( rect(), AlignCenter, "The Text" );
> }
>
> http://doc.trolltech.com/3.3/qpainter.html#details
>
> Regards,
> Malte
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 7 in thread
> There is no API related to foreground color of qpainter..
>
> Can u tell me plz how to do this
Just use void QPainter::setPen ( const QColor & color ) ;
Regards,
Malte
--
[ signature omitted ]
Message 8 in thread
hi,
Can we do, more than one tasks in paintEvent??? for e.g.
paintFlag=0;
void Form1::paintEvent( QPaintEvent * )
{
if(paintFlag==1)
{
//paint.setBackgroundMode(Qt::OpaqueMode );
QPainter paint( this );
paint.setBackgroundColor(Qt::white);
paint.setPen(Qt::red);
paint.drawText(200,100,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",-1,QPainter::LTR);
paintFlag=0;
}
else
{
QPainter paint( this );
paint.drawImage(0,0, img, 0,0,-1,-1,0 );
puts("AAAAAAAAAAAAAAA");
paintFlag=1;
}
}
and i am calling update() 2 times from focusInEvent of form.
image is showing first time correctly, but text is not coming on form....
Can u tell me what's wrong???
Thanks and Regards,
Niranjan.
On Tuesday 17 July 2007 17:27, Malte Witt wrote:
> > There is no API related to foreground color of qpainter..
> >
> > Can u tell me plz how to do this
>
> Just use void QPainter::setPen ( const QColor & color ) ;
>
> Regards,
>
> Malte
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 9 in thread
QT just doesn't work like that....
Your probably getting a ton of debug output saying the paint device is
not active etc etc....
Overload the paintEvent, and use the painter sent in.
Scott
> -----Original Message-----
> From: Niranjan [mailto:niranjank@xxxxxxxxxxxx]
> Sent: Tuesday, July 17, 2007 3:54 AM
> To: Andre Haupt; qt-interest@xxxxxxxxxxxxx
> Subject: Re: writing on qt form
>
> hi,
>
> i used
>
> QPainter p1;
> p1.drawText(200,100,"aaaaaaaaaaaaaaaaaa",8,QPainter::LTR);
>
> in focusInEvent of form, but text is not showing on form,
>
> can u tell me what's the wrong????
>
>
> Thanks and Reagrds,
> Niranjan
>
> On Tuesday 17 July 2007 15:59, Andre Haupt wrote:
> > Malte Witt wrote:
> > > With Qt4 you can use QPainter::drawText() .. I am not sure if
there is
> a
> > > Qt3 equivalent ...
> >
> > It does also exist in Qt3
> >
> > http://doc.trolltech.com/3.3/qpainter.html#drawText
> >
> >
> > regards,
> >
> > Andre
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> > "unsubscribe" in the subject or the body. List archive and
information:
> > http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]