Esempio n. 1
0
TabWidget*
GuiPrivate::getOnly1NonFloatingPane(int & count) const
{
    count = 0;
    std::list<TabWidgetI*> tabs = _gui->getApp()->getTabWidgetsSerialization();
    if ( tabs.empty() ) {
        return NULL;
    }
    TabWidget* firstNonFloating = 0;
    for (std::list<TabWidgetI*>::const_iterator it = tabs.begin(); it != tabs.end(); ++it) {
        TabWidget* isWidget = dynamic_cast<TabWidget*>(*it);
        assert(isWidget);
        if (!isWidget) {
            continue;
        }
        if ( !isWidget->isFloatingWindowChild() ) {
            if (!firstNonFloating) {
                firstNonFloating = isWidget;
            }
            ++count;
        }
    }
    ///there should always be at least 1 non floating window
    assert(firstNonFloating);

    return firstNonFloating;
}
Esempio n. 2
0
void
PanelWidget::handleUnCaughtKeyPressEvent(QKeyEvent* e)
{
    if (!_gui) {
        return;
    }
    _gui->setLastKeyPressVisitedClickFocus(_gui->getCurrentPanelFocus() == this);
    TabWidget* parentPane = getParentPane();
    if ( parentPane && parentPane->isFloatingWindowChild() ) {
        //We have to send the event to the Gui object, because it won't receive it as they are part from different windows
        qApp->sendEvent(_gui, e);
    }
}
Esempio n. 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();
}