Beispiel #1
0
void
Gui::createDefaultLayout1()
{
    ///First tab widget must be created this way
    TabWidget* mainPane = new TabWidget(this, _imp->_leftRightSplitter);
    {
        QMutexLocker l(&_imp->_panesMutex);
        _imp->_panes.push_back(mainPane);
    }

    mainPane->setObjectName_mt_safe( QString::fromUtf8("pane1") );
    mainPane->setAsAnchor(true);

    _imp->_leftRightSplitter->addWidget(mainPane);

    QList<int> sizes;
    sizes << _imp->_toolBox->sizeHint().width() << width();
    _imp->_leftRightSplitter->setSizes_mt_safe(sizes);


    TabWidget* propertiesPane = mainPane->splitHorizontally(false);
    TabWidget* workshopPane = mainPane->splitVertically(false);
    Splitter* propertiesSplitter = dynamic_cast<Splitter*>( propertiesPane->parentWidget() );
    assert(propertiesSplitter);
    sizes.clear();
    sizes << width() * 0.65 << width() * 0.35;
    propertiesSplitter->setSizes_mt_safe(sizes);

    TabWidget::moveTab(_imp->_nodeGraphArea, _imp->_nodeGraphArea, workshopPane);
    TabWidget::moveTab(_imp->_curveEditor, _imp->_curveEditor, workshopPane);
    TabWidget::moveTab(_imp->_dopeSheetEditor, _imp->_dopeSheetEditor, workshopPane);
    TabWidget::moveTab(_imp->_propertiesBin, _imp->_propertiesBin, propertiesPane);

    {
        QMutexLocker l(&_imp->_viewerTabsMutex);
        for (std::list<ViewerTab*>::iterator it2 = _imp->_viewerTabs.begin(); it2 != _imp->_viewerTabs.end(); ++it2) {
            TabWidget::moveTab(*it2, *it2, mainPane);
        }
    }
    {
        QMutexLocker l(&_imp->_histogramsMutex);
        for (std::list<Histogram*>::iterator it2 = _imp->_histograms.begin(); it2 != _imp->_histograms.end(); ++it2) {
            TabWidget::moveTab(*it2, *it2, mainPane);
        }
    }


    ///Default to NodeGraph displayed
    workshopPane->makeCurrentTab(0);
}
Beispiel #2
0
void TabWidget::splitHorizontally(){
    
    QMutexLocker l(&_tabWidgetStateMutex);
    Splitter* container = dynamic_cast<Splitter*>(parentWidget());
    if(!container){
        return;
    }
    
    /*We need to know the position in the container layout of the old tab widget*/
    int oldIndex = container->indexOf(this);
    
    QList<int> containerSizes = container->sizes();
    
    Splitter* newSplitter = new Splitter(container);
    newSplitter->setObjectName_mt_safe(container->objectName()+TabWidget::splitHorizontallyTag);
    newSplitter->setContentsMargins(0, 0, 0, 0);
    newSplitter->setOrientation(Qt::Horizontal);
    setVisible(false);
    setParent(newSplitter);
    newSplitter->addWidget(this);
    setVisible(true);
    _gui->registerSplitter(newSplitter);
    
    /*Adding now a new tab*/
    TabWidget* newTab = new TabWidget(_gui,TabWidget::CLOSABLE,newSplitter);
    newTab->setObjectName_mt_safe(objectName()+TabWidget::splitHorizontallyTag);
    _gui->registerPane(newTab);
    newSplitter->addWidget(newTab);
    
    QSize splitterSize = newSplitter->sizeHint();
    QList<int> sizes; sizes <<   splitterSize.width()/2;
    sizes  << splitterSize.width()/2;
    newSplitter->setSizes_mt_safe(sizes);
    
    /*Inserting back the new splitter at the original index*/
    container->insertWidget(oldIndex,newSplitter);
    
    ///restore the container original sizes
    container->setSizes_mt_safe(containerSizes);
    
    _userSplits.insert(std::make_pair(newTab,false));
    
    if (!_gui->getApp()->getProject()->isLoadingProject()) {
        _gui->getApp()->triggerAutoSave();
    }
}