mirror of
https://github.com/zealdocs/zeal.git
synced 2024-12-02 09:44:14 +03:00
ui: Fix missing selection in duplicated tabs
This commit is contained in:
parent
465a8b92a8
commit
4ba5512411
@ -566,8 +566,11 @@ void MainWindow::duplicateTab(int index)
|
||||
if (index < 0 || index >= m_tabStates.size())
|
||||
return;
|
||||
|
||||
TabState *tabState = m_tabStates.at(index);
|
||||
syncTabState(tabState);
|
||||
|
||||
using Registry::SearchModel;
|
||||
TabState *newTab = new TabState(*m_tabStates.at(index));
|
||||
TabState *newTab = new TabState(*tabState);
|
||||
connect(newTab->searchModel, &SearchModel::updated, this, &MainWindow::queryCompleted);
|
||||
connect(newTab->tocModel, &SearchModel::updated, this, &MainWindow::syncToc);
|
||||
|
||||
@ -649,10 +652,7 @@ void MainWindow::setupTabBar()
|
||||
TabState *previousTabState
|
||||
= static_cast<TabState *>(m_tabBar->property(PreviousTabState).value<void *>());
|
||||
if (m_tabStates.contains(previousTabState)) {
|
||||
previousTabState->selections = ui->treeView->selectionModel()->selectedIndexes();
|
||||
previousTabState->searchScrollPosition = ui->treeView->verticalScrollBar()->value();
|
||||
previousTabState->tocScrollPosition = ui->tocListView->verticalScrollBar()->value();
|
||||
previousTabState->zoomLevel = ui->webView->zoomLevel();
|
||||
syncTabState(previousTabState);
|
||||
}
|
||||
|
||||
// Load current tab state
|
||||
@ -752,6 +752,14 @@ void MainWindow::removeTrayIcon()
|
||||
delete trayIconMenu;
|
||||
}
|
||||
|
||||
void MainWindow::syncTabState(TabState *tabState)
|
||||
{
|
||||
tabState->selections = ui->treeView->selectionModel()->selectedIndexes();
|
||||
tabState->searchScrollPosition = ui->treeView->verticalScrollBar()->value();
|
||||
tabState->tocScrollPosition = ui->tocListView->verticalScrollBar()->value();
|
||||
tabState->zoomLevel = ui->webView->zoomLevel();
|
||||
}
|
||||
|
||||
void MainWindow::bringToFront()
|
||||
{
|
||||
show();
|
||||
|
@ -96,6 +96,8 @@ private:
|
||||
void createTrayIcon();
|
||||
void removeTrayIcon();
|
||||
|
||||
void syncTabState(TabState *tabState);
|
||||
|
||||
QList<TabState *> m_tabStates;
|
||||
|
||||
Ui::MainWindow *ui = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user