Beispiel #1
0
void TabWidget::stopDragTab(const QPoint& globalPos) {
    
    if (_isFloating && count() == 0) {
        closeFloatingPane();
    }
    
    QWidget* draggedPanel = _gui->stopDragPanel();
    const std::list<TabWidget*> panes = _gui->getPanes();
    
    bool foundTabWidgetUnderneath = false;
    for (std::list<TabWidget*>::const_iterator it = panes.begin(); it!=panes.end(); ++it) {
        if ((*it)->isWithinWidget(globalPos)) {
            (*it)->appendTab(draggedPanel);
            foundTabWidgetUnderneath = true;
            break;
        }
    }
    
    if (!foundTabWidgetUnderneath) {
        ///if we reach here that means the mouse is not over any tab widget, then float the panel
        TabWidget* newTab = new TabWidget(_gui,TabWidget::CLOSABLE);
        newTab->appendTab(draggedPanel);
        QPoint windowPos = globalPos;
        newTab->floatPane(&windowPos);
        
    }
    
}
Beispiel #2
0
void TabWidget::floatTab(QWidget* tab) {
    std::vector<QWidget*>::iterator it = std::find(_tabs.begin(),_tabs.end(),tab);
    if (it != _tabs.end()) {
        TabWidget* newTab = new TabWidget(_gui,TabWidget::CLOSABLE);
        removeTab(*it);
        newTab->appendTab(*it);
        newTab->floatPane();
        if(_tabBar->count() == 0){
            _floatButton->setEnabled(false);
        }
    }
}