[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: possible bug in QPainter::pos() : no logical position
From:       Bugs <qt-bugs () trolltech ! com>
Date:       2002-01-29 11:06:21
[Download RAW message or body]

On Tuesday 29 January 2002 11:30, Bugs wrote:
> On Monday 28 January 2002 20:43, David Faure wrote:
>
> c> On Monday 28 January 2002 20:06, lorthiois thierry wrote:
> > > Hi,
> > >
> > > Using Qt 3.0.1,
> > > I try the following code in kwmf :
> > >   mPainter.setWindow( 0, 0, 4800, 1792 );
> > >   mPainter.moveTo( 912, 896 );
> > >   QPoint pos1 = mPainter.pos();
> > >   fprintf(stderr, "  position : (%d, %d) \n", pos1.x(), pos1.y());
> > >
> > > Results:
> > > setWindow (0, 0, 4800, 1792)
> > > moveTo (912, 896)
> > >   position : (153, 150)
> > > moveTo (657, 1001)
> > >   position : (110, 168)
> > >
> > > QPainter::pos() return pixel position. ??
> >
> > Looks like a bug indeed, with an easy fix
> > (calling mapInv in QPainter::pos())
>
> Hi David,
>
> Indeed, looks to be a bug.  This should fix it:
>
> QPoint QPainter::pos() const
> {
>     int x, y;
>     x = curPt.x();
>     y = curPt.y();
>     if ( testf(VxF|WxF) )
>         mapInv( x, y, &x, &y );
>     return QPoint( x, y );
> }

Actually, this is wrong, and will result in lots of error output.

The right fix should really be:

/*!
  Returns the current position of the  pen.

  \sa moveTo()
 */
QPoint QPainter::pos() const
{
    return xFormDev( curPt );
}


> I'll pass this on to make sure all the other platforms work the same.
>
> > Forwarding to qt-bugs.

-- 
--
Bradley T. Hughes - bhughes at trolltech.com
Trolltech AS - Waldemar Thranes gt. 98 N-0175 Oslo, Norway

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic