PDA

View Full Version : what's the equivalent with DPtoLP in windows



cocalele
27th February 2006, 07:28
I has used QPainter::setWindow to map my logic cooridnate system to meet with the view cooridnate, then at the slot of mousePress event, how can I map back the device cooridnate to logic cooridnate. I know in windows programing, the function LPtoDP do this. Is there an equivalent in Qt or any other method?

Thanks

wysota
27th February 2006, 10:23
There is a family of "mapTo" and "mapFrom" methods in various classes. The painter always operates on "logic" coordinates. The widget should operate on "physical" ones.

cocalele
28th February 2006, 09:29
There is a family of "mapTo" and "mapFrom" methods in various classes. The painter always operates on "logic" coordinates. The widget should operate on "physical" ones.

Thank you. But I need a little more help. How can I get the display_id which is needed by QScreen constructor?

zlatko
28th February 2006, 09:42
Try leave it in 0 :rolleyes:

wysota
28th February 2006, 12:27
Thank you. But I need a little more help. How can I get the display_id which is needed by QScreen constructor?

What do you need a QScreen object for?

cocalele
1st March 2006, 02:01
What do you need a QScreen object for?

I want to use the member of QScreen mapFromDevice.

It seems QScreen is part of Qtopia, I even can't find the head file QScreen in my Qt installation directory

wysota
1st March 2006, 06:57
How about QWidget's:


QPoint mapFrom ( QWidget * parent, const QPoint & pos ) const
QPoint mapFromGlobal ( const QPoint & pos ) const
QPoint mapFromParent ( const QPoint & pos ) const
QPoint mapTo ( QWidget * parent, const QPoint & pos ) const
QPoint mapToGlobal ( const QPoint & pos ) const
QPoint mapToParent ( const QPoint & pos ) const