开发者

QWidget::mapToGlobal() when the widget is not visible

can QWidget::mapToGlobal work when the widget is not visible ? I dont find anything on the manual . If it cannot Why开发者_开发技巧 ?


I've just written a small program that calls QWidget::mapToGlobal( QPoint( 0,0 ) ) on a hidden widget. What I found was that the position I got varied, depending on whether the widget had already been displayed on screen before I queried its position.

The QWidget::mapToGlobal() documentation says:

Translates the widget coordinate pos to global screen coordinates. For example, mapToGlobal(QPoint(0,0)) would give the global coordinates of the top-left pixel of the widget.

Reading that, it does seem logical that if the widget is not visible, it cannot possibly have a guaranteed global position on the screen.

The actual result you get from calling the method seems to depend on the position the widget was last displayed at, if any. So it seems unwise to depend on this behaviour being stable across current or future versions of Qt.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜