Merge pull request #937 from ONLYOFFICE/fix/tab_switching

Fix switching tabs with Ctrl+Tab shortcut
This commit is contained in:
Maxim Kadushkin
2023-08-25 16:56:34 +03:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@ -142,6 +142,11 @@ CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
static int _dropedindex = -1;
QObject::connect(this, &CAscTabWidget::currentChanged, this, [=](int index) {
QTimer::singleShot(0, this, [=]() {
if (index != -1 && index != m_pBar->currentIndex()) {
m_pBar->blockSignals(true);
m_pBar->setCurrentIndex(index);
m_pBar->blockSignals(false);
}
updateIcons();
});
setFocusedView();
@ -171,7 +176,9 @@ CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
}
});
auto turnOffAltHints = [=](int old_index, int index) {
this->setCurrentIndex(index);
QTimer::singleShot(0, this, [=]() {
setCurrentIndex(index);
});
if (old_index > -1)
AscAppManager::sendCommandTo(panel(old_index)->cef(), L"althints:show", L"false");
};

View File

@ -521,11 +521,11 @@ void CMainWindow::onEditorAllowedClose(int uid)
} else {
int _index = m_pTabs->tabIndexByView(uid);
if ( !(_index < 0) ) {
m_pTabs->tabBar()->removeTab(_index);
QWidget * _view = m_pTabs->widget(_index);
m_pTabs->removeWidget(_view);
_view->deleteLater();
m_pTabs->tabBar()->removeTab(_index);
//m_pTabs->adjustTabsSize();
onTabChanged(m_pTabs->currentIndex());