EditMode::EditMode(EditorManager *editorManager) : m_editorManager(editorManager), m_splitter(new MiniSplitter), m_rightSplitWidgetLayout(new QVBoxLayout) { m_rightSplitWidgetLayout->setSpacing(0); m_rightSplitWidgetLayout->setMargin(0); QWidget *rightSplitWidget = new QWidget; rightSplitWidget->setLayout(m_rightSplitWidgetLayout); m_rightSplitWidgetLayout->insertWidget(0, new Core::EditorManagerPlaceHolder(this)); m_rightSplitWidgetLayout->addWidget(new Core::FindToolBarPlaceHolder(this)); MiniSplitter *rightPaneSplitter = new MiniSplitter; rightPaneSplitter->insertWidget(0, rightSplitWidget); rightPaneSplitter->insertWidget(1, new RightPanePlaceHolder(this)); rightPaneSplitter->setStretchFactor(0, 1); rightPaneSplitter->setStretchFactor(1, 0); MiniSplitter *splitter = new MiniSplitter; splitter->setOrientation(Qt::Vertical); splitter->insertWidget(0, rightPaneSplitter); splitter->insertWidget(1, new Core::OutputPanePlaceHolder(this)); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(1, 0); m_splitter->insertWidget(0, new NavigationWidgetPlaceHolder(this)); m_splitter->insertWidget(1, splitter); m_splitter->setStretchFactor(0, 0); m_splitter->setStretchFactor(1, 1); ModeManager *modeManager = ModeManager::instance(); connect(modeManager, SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(grabEditorManager(Core::IMode*))); m_splitter->setFocusProxy(m_editorManager); }
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))); }
EditMode::EditMode() : m_splitter(new MiniSplitter), m_rightSplitWidgetLayout(new QVBoxLayout) { setObjectName(QLatin1String("EditMode")); setDisplayName(tr("Edit")); setIcon(Utils::Icon::modeIcon(Icons::MODE_EDIT_CLASSIC, Icons::MODE_EDIT_FLAT, Icons::MODE_EDIT_FLAT_ACTIVE)); setPriority(Constants::P_MODE_EDIT); setId(Constants::MODE_EDIT); m_rightSplitWidgetLayout->setSpacing(0); m_rightSplitWidgetLayout->setMargin(0); QWidget *rightSplitWidget = new QWidget; rightSplitWidget->setLayout(m_rightSplitWidgetLayout); auto editorPlaceHolder = new EditorManagerPlaceHolder(Constants::MODE_EDIT); m_rightSplitWidgetLayout->insertWidget(0, editorPlaceHolder); MiniSplitter *rightPaneSplitter = new MiniSplitter; rightPaneSplitter->insertWidget(0, rightSplitWidget); rightPaneSplitter->insertWidget(1, new RightPanePlaceHolder(Constants::MODE_EDIT)); rightPaneSplitter->setStretchFactor(0, 1); rightPaneSplitter->setStretchFactor(1, 0); MiniSplitter *splitter = new MiniSplitter; splitter->setOrientation(Qt::Vertical); splitter->insertWidget(0, rightPaneSplitter); QWidget *outputPane = new OutputPanePlaceHolder(Constants::MODE_EDIT, splitter); outputPane->setObjectName(QLatin1String("EditModeOutputPanePlaceHolder")); splitter->insertWidget(1, outputPane); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(1, 0); m_splitter->insertWidget(0, new NavigationWidgetPlaceHolder(Constants::MODE_EDIT)); m_splitter->insertWidget(1, splitter); m_splitter->setStretchFactor(0, 0); m_splitter->setStretchFactor(1, 1); connect(ModeManager::instance(), &ModeManager::currentModeChanged, this, &EditMode::grabEditorManager); m_splitter->setFocusProxy(editorPlaceHolder); IContext *modeContextObject = new IContext(this); modeContextObject->setContext(Context(Constants::C_EDITORMANAGER)); modeContextObject->setWidget(m_splitter); ICore::addContextObject(modeContextObject); setWidget(m_splitter); setContext(Context(Constants::C_EDIT_MODE, Constants::C_NAVIGATION_PANE)); }
EditMode::EditMode() : m_splitter(new MiniSplitter), m_rightSplitWidgetLayout(new QVBoxLayout) { setObjectName(QLatin1String("EditMode")); setDisplayName(tr("Edit")); setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Edit.png"))); setPriority(Constants::P_MODE_EDIT); setId(Constants::MODE_EDIT); m_rightSplitWidgetLayout->setSpacing(0); m_rightSplitWidgetLayout->setMargin(0); QWidget *rightSplitWidget = new QWidget; rightSplitWidget->setLayout(m_rightSplitWidgetLayout); m_rightSplitWidgetLayout->insertWidget(0, new Core::EditorManagerPlaceHolder(this)); MiniSplitter *rightPaneSplitter = new MiniSplitter; rightPaneSplitter->insertWidget(0, rightSplitWidget); rightPaneSplitter->insertWidget(1, new RightPanePlaceHolder(this)); rightPaneSplitter->setStretchFactor(0, 1); rightPaneSplitter->setStretchFactor(1, 0); MiniSplitter *splitter = new MiniSplitter; splitter->setOrientation(Qt::Vertical); splitter->insertWidget(0, rightPaneSplitter); QWidget *outputPane = new Core::OutputPanePlaceHolder(this, splitter); outputPane->setObjectName(QLatin1String("EditModeOutputPanePlaceHolder")); splitter->insertWidget(1, outputPane); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(1, 0); m_splitter->insertWidget(0, new NavigationWidgetPlaceHolder(this)); m_splitter->insertWidget(1, splitter); m_splitter->setStretchFactor(0, 0); m_splitter->setStretchFactor(1, 1); connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(grabEditorManager(Core::IMode*))); m_splitter->setFocusProxy(EditorManager::instance()); setWidget(m_splitter); setContext(Context(Constants::C_EDIT_MODE, Constants::C_EDITORMANAGER, Constants::C_NAVIGATION_PANE)); }