void SplitterOrView::split(Qt::Orientation orientation) { Q_ASSERT(m_view); Q_ASSERT(!m_splitter); MiniSplitter *splitter = new MiniSplitter(this); splitter->setOrientation(orientation); layout()->addWidget(splitter); // [OP-1586] make sure that the view never becomes parent less otherwise a rendering bug happens // in osgearth QML views (not all kind of scenes are affected but those containing terrain are) // Making the view parent less will destroy the OpenGL context used by the QQuickFramebufferObject used OSGViewport // A new OpenGL context will be created but for some reason, osgearth does not switch to it gracefully. // Enabling the stats overlay (by pressing the 's' key in the view) will restore proper rendering (?). // Note : avoiding to make the view parent less is a workaround... the real cause of the rendering bug needs to be // understood and fixed (the same workaround is also need in unsplit and unsplitAll) // Important : the changes also apparently make splitting and un-splitting more reactive and less jumpy! // Give our view to the new left or top SplitterOrView. splitter->addWidget(new SplitterOrView(*this, splitter)); splitter->addWidget(new SplitterOrView(m_uavGadgetManager)); m_view = 0; m_splitter = splitter; connect(m_splitter, SIGNAL(splitterMoved(int, int)), this, SLOT(onSplitterMoved(int, int))); }
QProjectWidget::QProjectWidget(QWidget * parent): QAbstractPageWidget(parent), m_projectPropertyView(new QPropertyListView(this)), m_projectBar(new StyledBar(this)), m_pageView(new QPageView(this)), m_pageViewBar(new StyledBar(this)) { QVBoxLayout *vl = new QVBoxLayout; MiniSplitter *sp = new MiniSplitter; vl->setMargin(0); vl->addWidget(sp); setLayout(vl); QWidget* wid = new QWidget; sp->addWidget(wid); vl = new QVBoxLayout; vl->setMargin(0); vl->setSpacing(0); vl->addWidget(m_projectBar); vl->addWidget(m_projectPropertyView); wid->setLayout(vl); QScrollArea * pagePane = new QScrollArea; pagePane->setWidget(m_pageView); pagePane->setFrameStyle(QFrame::NoFrame); pagePane->viewport()->setStyleSheet("background-color:rgb(255,255,255);"); wid = new QWidget; vl = new QVBoxLayout; vl->setMargin(0); vl->setSpacing(0); vl->addWidget(m_pageViewBar); vl->addWidget(pagePane); wid->setLayout(vl); sp->addWidget(wid); sp->setStretchFactor(0,0); sp->setStretchFactor(1,1); connect(QSoftCore::getInstance()->getProject(),SIGNAL(hostAdded(QAbstractWidgetHost*,int)), m_pageView,SLOT(addHost(QAbstractWidgetHost*,int))); }