[Qt-interest] move() a widget and mapTo()
Giacomo
giacomo.strangolino at elettra.trieste.it
Mon Nov 2 12:22:57 CET 2009
Hi to all.
I am experiencing a strange behaviour.
In my Qt 4.5.3 application I call move() on a widget and move it by one pixel.
after move(), widget->mapTo(widget->parentWidget(), newpos) shows a delta
x (or y) of 2 instead of 1 pixel only.
The code
qDebug() << "widget topLeft() BEFORE: " << w->geometry().topLeft() << "
mappedTo(): " << w->mapTo(MangoWidget::instance(), w->geometry().topLeft());
w->setGeometry(QRect(newTopLeft, w->geometry().size()));
qDebug() << "widget topLeft() AFTER: " << w->geometry().topLeft() << "
mappedTo(): " << w->mapTo(MangoWidget::instance(), w->geometry().topLeft());
produces output:
widget topLeft() BEFORE: QPoint(12,23) mappedTo(): QPoint(374,368)
widget topLeft() AFTER: QPoint(11,23) mappedTo(): QPoint(372,368)
As you can see widget position changes of 1 pixel 12->11 but the mapped
position changes of 2 pixels (374->372)
Thanks in advance for any hint.
Giacomo
More information about the Qt-interest-old
mailing list