diff options
Diffstat (limited to 'src/subwindow')
-rw-r--r-- | src/subwindow/subwindow.cpp | 3 | ||||
-rw-r--r-- | src/subwindow/tabwidget.cpp | 16 |
2 files changed, 7 insertions, 12 deletions
diff --git a/src/subwindow/subwindow.cpp b/src/subwindow/subwindow.cpp index 6e9a713..a2d6138 100644 --- a/src/subwindow/subwindow.cpp +++ b/src/subwindow/subwindow.cpp @@ -57,7 +57,6 @@ SubWindow::SubWindow(QWidget *parent, Qt::WindowFlags flags) close(); } else { auto *view = dynamic_cast<WebView *>(tabWidget->widget(index)); - Q_CHECK_PTR(view); disconnect(titleConnection); disconnect(linkHoveredConnection); @@ -67,12 +66,10 @@ SubWindow::SubWindow(QWidget *parent, Qt::WindowFlags flags) this->setWindowTitle(QString("%1 :%2").arg(title, v->profile()->name())); }); setWindowTitle(QString("%1 :%2").arg(view->title(), view->profile()->name())); - linkHoveredConnection = connect(view->page(), &WebPage::linkHovered, this, [this](const QString &url) { if(!url.isEmpty()) emit showStatusMessage(url, 3000); }); - emit currentViewChanged(view); } }); diff --git a/src/subwindow/tabwidget.cpp b/src/subwindow/tabwidget.cpp index 6f1e348..69f3b8a 100644 --- a/src/subwindow/tabwidget.cpp +++ b/src/subwindow/tabwidget.cpp @@ -42,8 +42,11 @@ TabWidget::TabWidget(SubWindow *parent) // when changing tabs, give focus to the widget // otherwise when closing tabs, the tabwidget will retain focus connect(this, &TabWidget::currentChanged, this, [this](int index) { - if(widget(index)) + previous = current; + current = index; + /*if(widget(index)) { widget(index)->setFocus(); + }*/ }); // context menu @@ -68,12 +71,6 @@ TabWidget::TabWidget(SubWindow *parent) removeTab(i); } }); - - // - connect(this, &TabWidget::currentChanged, this, [this](int index) { - previous = current; - current = index; - }); } TabWidget::~TabWidget() @@ -85,7 +82,9 @@ TabWidget::~TabWidget() int TabWidget::addTab(WebView *view) { - Q_ASSERT_X(view != nullptr, "TabWidget::addTab", "Tried to add null view"); + if(view == nullptr) { + return -1; + } const int idx = QTabWidget::addTab(view, view->title()); connect(view, &WebView::titleChanged, [this, view](const QString &title) { @@ -100,7 +99,6 @@ int TabWidget::addTab(WebView *view) setTabIcon(current_idx, icon); } }); - tabBar()->setTabData(idx, QVariant::fromValue<SubWindow::TabData>(SubWindow::TabData{})); return idx; } |