##// END OF EJS Templates
Change the opengl widget to be child of the first view of the scene...
Miikka Heikkinen -
r2841:3448d86fc598
parent child
Show More
@@ -551,17 +551,15 void ChartPresenter::ensureGLWidget()
551 // GLWidget pointer is wrapped in QPointer as its parent is not in our control, and therefore
551 // GLWidget pointer is wrapped in QPointer as its parent is not in our control, and therefore
552 // can potentially get deleted unexpectedly.
552 // can potentially get deleted unexpectedly.
553 if (m_glWidget.isNull() && m_glUseWidget && m_chart->scene()) {
553 if (m_glWidget.isNull() && m_glUseWidget && m_chart->scene()) {
554 QObject *parent = m_chart->scene()->parent();
554 // Find the view of the scene. If the scene has multiple views, only the first view is
555 while (parent) {
555 // chosen.
556 QWidget *parentWidget = qobject_cast<QWidget *>(parent);
556 QList<QGraphicsView *> views = m_chart->scene()->views();
557 if (parentWidget) {
557 if (views.size()) {
558 m_glWidget = new GLWidget(m_chart->d_ptr->m_dataset->glXYSeriesDataManager(),
558 QGraphicsView *firstView = views.at(0);
559 parentWidget);
559 m_glWidget = new GLWidget(m_chart->d_ptr->m_dataset->glXYSeriesDataManager(),
560 m_glWidget->setGeometry(m_rect.toRect());
560 firstView);
561 m_glWidget->show();
561 m_glWidget->setGeometry(m_rect.toRect());
562 break;
562 m_glWidget->show();
563 }
564 parent = parent->parent();
565 }
563 }
566 }
564 }
567 #endif
565 #endif
General Comments 0
You need to be logged in to leave comments. Login now