Beispiel #1
0
void TabWidget::moveTab(QWidget* what,TabWidget *where){
    TabWidget* from = dynamic_cast<TabWidget*>(what->parentWidget());
    
    if(!from){
        return;
    }
    if(from == where){
        /*We check that even if it is the same TabWidget, it really exists.*/
        bool found = false;
        for (int i =0; i < from->count(); ++i) {
            if (what == from->tabAt(i)) {
                found = true;
                break;
            }
        }
        if (found) {
            return;
        }
        //it wasn't found somehow
    }
    
    from->removeTab(what);
    assert(where);
    where->appendTab(what);
    what->setParent(where);
    where->getGui()->getApp()->triggerAutoSave();
}
Beispiel #2
0
void
GuiPrivate::notifyGuiClosing()
{
    ///This is to workaround an issue that when destroying a widget it calls the focusOut() handler hence can
    ///cause bad pointer dereference to the Gui object since we're destroying it.
    std::list<TabWidgetI*> tabs = _gui->getApp()->getTabWidgetsSerialization();

    for (std::list<TabWidgetI*>::iterator it = tabs.begin(); it != tabs.end(); ++it) {
        TabWidget* tab = dynamic_cast<TabWidget*>(*it);
        if (!tab) {
            continue;
        }
        tab->discardGuiPointer();
        for (int i = 0; i < tab->count(); ++i) {
            tab->tabAt(i)->notifyGuiClosingPublic();
        }
    }

    const NodesGuiList allNodes = _nodeGraphArea->getAllActiveNodes();


    // we do not need this list anymore, avoid using it
    _gui->getApp()->clearSettingsPanels();



    for (NodesGuiList::const_iterator it = allNodes.begin(); it != allNodes.end(); ++it) {
        DockablePanel* panel = (*it)->getSettingPanel();
        if (panel) {
            panel->onGuiClosing();
        }
    }
    _lastFocusedGraph = 0;
}
Beispiel #3
0
void
Gui::maximize(TabWidget* what)
{
    assert(what);
    if ( what->isFloatingWindowChild() ) {
        return;
    }

    std::list<TabWidgetI*> panes = getApp()->getTabWidgetsSerialization();
    for (std::list<TabWidgetI*>::iterator it = panes.begin(); it != panes.end(); ++it) {
        TabWidget* pane = dynamic_cast<TabWidget*>(*it);
        if (!pane) {
            continue;
        }
        //if the widget is not what we want to maximize and it is not floating , hide it
        if ( (pane != what) && !pane->isFloatingWindowChild() ) {
            // also if we want to maximize the workshop pane, don't hide the properties pane

            bool hasProperties = false;
            for (int i = 0; i < pane->count(); ++i) {
                QString tabName = pane->tabAt(i)->getWidget()->objectName();
                if ( tabName == QString::fromUtf8(kPropertiesBinName) ) {
                    hasProperties = true;
                    break;
                }
            }

            bool hasNodeGraphOrCurveEditor = false;
            for (int i = 0; i < what->count(); ++i) {
                QWidget* tab = what->tabAt(i)->getWidget();
                assert(tab);
                NodeGraph* isGraph = dynamic_cast<NodeGraph*>(tab);
                AnimationModuleEditor* isEditor = dynamic_cast<AnimationModuleEditor*>(tab);
                if (isGraph || isEditor) {
                    hasNodeGraphOrCurveEditor = true;
                    break;
                }
            }

            if (hasProperties && hasNodeGraphOrCurveEditor) {
                continue;
            }
            pane->hide();
        }
    }
    _imp->_toolBox->hide();
}