mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-27 11:44:56 +03:00
ui: Fix new tabs always showing the welcome page (fixes #851)
This commit is contained in:
parent
a406f8de5f
commit
d0cdc200bb
@ -505,7 +505,7 @@ void MainWindow::moveTab(int from, int to) {
|
||||
ui->webViewStack->insertWidget(to, w);
|
||||
}
|
||||
|
||||
void MainWindow::createTab(int index)
|
||||
WebViewTab *MainWindow::createTab(int index)
|
||||
{
|
||||
if (m_settings->openNewTabAfterActive)
|
||||
index = m_tabBar->currentIndex() + 1;
|
||||
@ -521,6 +521,8 @@ void MainWindow::createTab(int index)
|
||||
m_tabBar->setCurrentIndex(index);
|
||||
|
||||
ui->lineEdit->setFocus();
|
||||
|
||||
return newState->widget;
|
||||
}
|
||||
|
||||
void MainWindow::duplicateTab(int index)
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
|
||||
void search(const Zeal::Registry::SearchQuery &query);
|
||||
void bringToFront();
|
||||
void createTab(int index = -1);
|
||||
WebViewTab *createTab(int index = -1);
|
||||
|
||||
public slots:
|
||||
void toggleWindow();
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "webview.h"
|
||||
|
||||
#include "webviewtab.h"
|
||||
#include "../mainwindow.h"
|
||||
|
||||
#include <core/application.h>
|
||||
@ -94,9 +95,8 @@ QWebView *WebView::createWindow(QWebPage::WebWindowType type)
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
|
||||
MainWindow *mw = qobject_cast<MainWindow *>(qApp->activeWindow());
|
||||
mw->createTab();
|
||||
return this;
|
||||
MainWindow *mainWindow = qobject_cast<MainWindow *>(qApp->activeWindow());
|
||||
return mainWindow->createTab()->m_webView;
|
||||
}
|
||||
|
||||
void WebView::mousePressEvent(QMouseEvent *event)
|
||||
|
@ -68,6 +68,8 @@ protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
friend class WebView;
|
||||
|
||||
WebView *m_webView = nullptr;
|
||||
SearchToolBar *m_searchToolBar = nullptr;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user