Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.0.1
-
None
-
Windows 7, Visual Studio 2010
Description
Problem:
After moving or reparenting a widget embedded via QGraphicsProxyWidget
mapToGlobal/mapFromGlobal won't give correct results.
Reason:
On showing a widget embedded in a QGraphicsView via QGraphicsProxyWidget a normal platform window is created (e.g. qwindowswindow.cpp WindowCreationData::create()). This native window is not used, because the widget will be embedded in the QGraphicsView.
But the method QWidget::mapToFromGlobal() sees the windowHandle() and uses window->mapFromGlobal(). (The same applies to mapToGlobal()). But
QWindowsWindow::m_data.geometry is not up-to-date.
Workaround:
In an application-eventFilter() do:
if ( (e->type()==QEvent::ShowToParent || e->type()==QEvent::Move) && o->isWidgetType() )
{
QWidget* pWidget = (QWidget*)o;
QGraphicsProxyWidget* pProxy = pWidget->graphicsProxyWidget();
if ( pWidget==pWidget->window() && pProxy )
}
It would be nicer of course if the fix could be in QGraphicsProxyWidget::eventFilter instead.
As an alternative the map-methods might use QWidget::graphicsProxyWidget().
Joachim