void TabSwitcherWidget::showEvent(QShowEvent *event)
{
	grabKeyboard();

	for (int i = 0; i < m_windowsManager->getWindowCount(); ++i)
	{
		Window *window = m_windowsManager->getWindowByIndex(i);

		if (window)
		{
			m_model->appendRow(createRow(window));
		}
	}

	m_model->sort(1, Qt::DescendingOrder);

	m_tabsView->setCurrentIndex(m_model->index(0, 0));

	const int contentsHeight = (m_model->rowCount() * 22);

	m_tabsView->setMinimumHeight(qMin(contentsHeight, int(height() * 0.9)));

	QWidget::showEvent(event);

	connect(m_windowsManager, SIGNAL(windowAdded(qint64)), this, SLOT(tabAdded(qint64)));
	connect(m_windowsManager, SIGNAL(windowRemoved(qint64)), this, SLOT(tabRemoved(qint64)));
}
Example #2
0
    bool TabsModel::removePluginTab(int index) {
        LOG_INFO << index;

        bool success = false;

        if ((0 <= index) && (index < m_TabsList.size())) {
            Q_ASSERT(!m_TabsList[index].m_IsSystemTab);
            if (!m_TabsList[index].m_IsSystemTab) {
                beginRemoveRows(QModelIndex(), index, index);
                {
                    m_TabsList.removeAt(index);
                }
                endRemoveRows();

                updateCache();
                emit tabRemoved();
                emit tabsCountChanged();
                success = true;
            } else {
                LOG_WARNING << "Attempt to remove system tab";
            }
        }

        return success;
    }
Example #3
0
void QTabWidget_QtDShell::__override_tabRemoved(int  index0, bool static_call)
{
    if (static_call) {
        QTabWidget::tabRemoved((int )index0);
    } else {
        tabRemoved((int )index0);
    }
}
void TabSwitcherWidget::hideEvent(QHideEvent *event)
{
	releaseKeyboard();

	QWidget::hideEvent(event);

	disconnect(m_windowsManager, SIGNAL(windowAdded(qint64)), this, SLOT(tabAdded(qint64)));
	disconnect(m_windowsManager, SIGNAL(windowRemoved(qint64)), this, SLOT(tabRemoved(qint64)));

	m_model->clear();
}
Example #5
0
void ComboTabBar::removeTab(int index)
{
    if (validIndex(index)) {
        setUpdatesEnabled(false);

        localTabBar(index)->removeTab(toLocalIndex(index));
        updatePinnedTabBarVisibility();
        tabRemoved(index);
        setMinimumWidths();

        setUpdatesEnabled(true);
        updateTabBars();
    }
}