Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-30690

QGraphicsProxyWidget : Window-Geometry is not updated on move or reparent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.0.1
    • Widgets: GraphicsView
    • 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 )

      { pWidget->windowHandle()->setGeometry( pProxy->mapRectToScene( pProxy->rect() ).toRect() ); }

      }

      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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            joachim Joachim Eibl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes