[Qt-interest] QWinWidget's pos() always returns (0, 0)

william.crocker at analog.com william.crocker at analog.com
Thu May 27 04:21:10 CEST 2010



Long Cheng wrote:
> Hi William, I don't quite understand you. When you said "a call to 
> qApp->processEvents(...), placed here", where do you mean?
>


If "QWinWidget" implies that you are working under Windows
then this may not be applicable. Under X11 (where I work)
you have to flush move and resize requests to the server
and then give returning location and size change information
a chance to be processed. You do this by processing events.


> BTW, I found QWinWidget doesn't have parent QWidget, and the 
> QWinWidget->pos() is the position in its parent widget, that may be the 
> reason it is always zero.
> 
> On Wed, May 26, 2010 at 10:03 PM, william.crocker at analog.com 
> <mailto:william.crocker at analog.com> <william.crocker at analog.com 
> <mailto:william.crocker at analog.com>> wrote:
> 
> 
> 
>     Long Cheng wrote:
>      > I tried to change QWinWidget's position by calling
>     pWinWidget->move(50,
>      > 50), but after that the position returned by pWinWidget->pos()
>     was still
>      > (0, 0);
>      >
>      > QWinWidget* pWinWidget = new QWinWidget(pCView);
>      > pWinWidget->move(50, 50);
> 
> 
>     I find that a call to qApp->processEvents(...),
>     placed here, usualy takes care of this.
> 
> 
>      > QPoint pos = pWinWidget->pos(); //****NOTE: the pos equals to (0,
>     0)*****
>      >
>      > The code is based on Qt 4.5.2
>      >
>      > Thanks,
>      > Long
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      > _______________________________________________
>      > Qt-interest mailing list
>      > Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>      > http://lists.trolltech.com/mailman/listinfo/qt-interest
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> 



More information about the Qt-interest-old mailing list