PDA

View Full Version : widget's cooridanates into screen coordinates.



Rakesh_Kumar
19th November 2008, 02:52
Hi,

I want to find out the screen coordinats of the widgets for automated testing.
By usuing widget()->geometry() I am able to find out the coordinats of the widget.
Now I need to convert these cooridanates to Screen cooridanates.

I have tried to implement the rect() of the QAccessibleWidget like below but it's not giving the actual positions.

QRect AccessibleClock::rect(int index ) const
{
QRect relrc = this->widget()->geometry();
QPoint tl = this->widget()->mapToParent(QPoint(relrc.left(),relrc.top()));
QPoint br = this->widget()->mapToParent(QPoint(relrc.right(), relrc.bottom()));

QRect actrc( tl.x(), tl.y(), br.x(), br.y() );

switch (index)
{
case ClockSelf:

default:

return actrc;

}

Could anyone please help me to resolve the issue?

Thanks a lot in advance.

Regards
Rakesh:confused:

aamer4yu
19th November 2008, 04:16
QWidget::mapToGlobal :)