diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 75f1da3..29a5c8f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -43,6 +43,9 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : m_addressBar(new AddressBar(navigationToolBar)), m_progressBar(new LoadingBar(this)) { + // delete this window when it closes + setAttribute(Qt::WA_DeleteOnClose, true); + // set up UI ui->setupUi(this); QAction *fullscreenAction = new QAction(this); @@ -59,8 +62,8 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : MainWindowMenuBar *menuBar = new MainWindowMenuBar(this); menuBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - connect(menuBar->printAction(), &QAction::triggered, [this]() { - QString path = QFileDialog::getSaveFileName(this, tr("Print to PDF"), QDir::homePath(), tr("PDF files (*.pdf)")); + connect(menuBar->printAction(), &QAction::triggered, this, [&]() { + const QString path = QFileDialog::getSaveFileName(this, tr("Print to PDF"), QDir::homePath(), tr("PDF files (*.pdf)")); m_currentView->page()->printToPdf(path); }); @@ -94,17 +97,17 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : this->addToolBar(Qt::TopToolBarArea, navigationToolBar); // connect signals - connect(m_addressBar, &AddressBar::addressEntered, [&](const QUrl &url) { + connect(m_addressBar, &AddressBar::addressEntered, this, [&](const QUrl &url) { tabBar->currentView()->load(url); }); - connect(m_addressBar, &AddressBar::searchTermEntered, [&](const QString &string) { + connect(m_addressBar, &AddressBar::searchTermEntered, this, [&](const QString &string) { QString term = string.mid(1); term.replace(' ', '+'); tabBar->currentView()->load(QUrl::fromUserInput(qApp->settings()->value("general.search").toString().replace("$term", term))); }); connect(tabBar, SIGNAL(currentTabChanged(WebView*)), this, SLOT(handleTabChanged(WebView*))); - connect(qApp->bookmarks(), &BookmarksWidget::openUrl, [this](const QUrl &url) { + connect(qApp->bookmarks(), &BookmarksWidget::openUrl, this, [&](const QUrl &url) { if(this->isActiveWindow()) { this->newTab(url); } |