/**
 * Close a given tab
 * @param index :: The tab index
 */ 
void MultiTabScriptInterpreter::closeTabAtIndex(int index)
{
  ScriptFileInterpreter *interpreter = interpreterAt(index);
  interpreter->prepareToClose();
  emit tabClosing(index);
  removeTab(index);
  emit tabClosed(index);
  const int nTabs = count();
  emit tabCountChanged(nTabs);
  if(nTabs == 0) emit lastTabClosed();
}
Beispiel #2
0
/*!
   \brief TabWidget::closeTab
   \param index
 */
void TabWidget::closeTab(int index)
{
    Q_ASSERT(index < count());

    if(index < 0) {
        index = currentIndex();
    }

    QWidget *widget = this->widget(index);
    if(widget && widget->close()) {
        removeTab(index);
        widget->deleteLater();
    }

    emit tabClosed(index);
}
void DeclarativeTabModel::removeTab(int tabId, const QString &thumbnail, int index)
{
#ifdef DEBUG_LOGS
    qDebug() << "index:" << index << tabId;
#endif
    DBManager::instance()->removeTab(tabId);
    QFile f(thumbnail);
    if (f.exists()) {
        f.remove();
    }

    if (index >= 0) {
        m_tabs.removeAt(index);
    }

    emit countChanged();
    emit tabClosed(tabId);
}
Beispiel #4
0
//==========
//    PRIVATE
//==========
void MainUI::setupConnections(){
  connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)) );
  connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
  connect(ui->menuBookmarks, SIGNAL(triggered(QAction*)), this, SLOT(goToBookmark(QAction*)) );
  connect(ui->menuExternal_Devices, SIGNAL(triggered(QAction*)), this, SLOT(goToDevice(QAction*)) );
	
  //Radio Buttons
  connect(radio_view_details, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
  connect(radio_view_list, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) );
  connect(radio_view_tabs, SIGNAL(toggled(bool)), this, SLOT(groupModeChanged(bool)) );
  connect(radio_view_cols, SIGNAL(toggled(bool)), this, SLOT(groupModeChanged(bool)) );

  //Special Keyboard Shortcuts
  connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) );
  connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) );
  connect(closeTabShort, SIGNAL(activated()), this, SLOT( tabClosed() ) );

}
void DeclarativeTabModel::removeTab(int tabId, const QString &thumbnail, int index)
{
#if DEBUG_LOGS
    qDebug() << "index:" << index << tabId;
#endif
    removeTab(tabId);
    QFile f(thumbnail);
    if (f.exists()) {
        f.remove();
    }

    if (index >= 0) {
        if (activeTabIndex() == index) {
            m_activeTab.setTabId(0);
        }
        beginRemoveRows(QModelIndex(), index, index);
        m_tabs.removeAt(index);
        endRemoveRows();
    }

    emit countChanged();
    emit tabClosed(tabId);
}
Beispiel #6
0
void TabBar::mouseReleaseEvent(QMouseEvent* event)
{
    if (QWhatsThis::inWhatsThisMode()) return;

    if (event->x() < m_skin->tabBarPosition().x()) return;

    int index = tabAt(event->x());

    if (m_mousePressed && m_mousePressedIndex == index)
    {
        if (event->button() == Qt::LeftButton && index != m_tabs.indexOf(m_selectedSessionId))
            emit tabSelected(m_tabs.at(index));

        if (event->button() == Qt::MidButton)
            emit tabClosed(m_tabs.at(index));
    }

    m_mousePressed = false;

    m_startPos.setX(0);
    m_startPos.setY(0);

    QWidget::mouseReleaseEvent(event);
}
Beispiel #7
0
void TabBar::closeTabButtonClicked()
{
    emit tabClosed(m_selectedSessionId);
}
Beispiel #8
0
void MainUI::on_actionClose_Browser_triggered(){
  tabClosed();
}
Beispiel #9
0
void MainUI::CloseFile(){
  int index = ui->tabWidget->currentIndex();
  if(index>=0){ tabClosed(index); }
}