Skip to content

Commit

Permalink
Merge pull request #937 from ONLYOFFICE/fix/tab_switching
Browse files Browse the repository at this point in the history
Fix switching tabs with Ctrl+Tab shortcut
  • Loading branch information
maxkadushkin authored Aug 25, 2023
2 parents 179d936 + 8819f36 commit a541d0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion win-linux/src/components/asctabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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");
};
Expand Down
2 changes: 1 addition & 1 deletion win-linux/src/windows/cmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit a541d0a

Please sign in to comment.