##// 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 551 // GLWidget pointer is wrapped in QPointer as its parent is not in our control, and therefore
552 552 // can potentially get deleted unexpectedly.
553 553 if (m_glWidget.isNull() && m_glUseWidget && m_chart->scene()) {
554 QObject *parent = m_chart->scene()->parent();
555 while (parent) {
556 QWidget *parentWidget = qobject_cast<QWidget *>(parent);
557 if (parentWidget) {
558 m_glWidget = new GLWidget(m_chart->d_ptr->m_dataset->glXYSeriesDataManager(),
559 parentWidget);
560 m_glWidget->setGeometry(m_rect.toRect());
561 m_glWidget->show();
562 break;
563 }
564 parent = parent->parent();
554 // Find the view of the scene. If the scene has multiple views, only the first view is
555 // chosen.
556 QList<QGraphicsView *> views = m_chart->scene()->views();
557 if (views.size()) {
558 QGraphicsView *firstView = views.at(0);
559 m_glWidget = new GLWidget(m_chart->d_ptr->m_dataset->glXYSeriesDataManager(),
560 firstView);
561 m_glWidget->setGeometry(m_rect.toRect());
562 m_glWidget->show();
565 563 }
566 564 }
567 565 #endif
General Comments 0
You need to be logged in to leave comments. Login now