diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-03-20 16:47:12 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-03-20 16:47:12 +0100 |
commit | 861084180b3f5e08d539f73876acac5326e15d64 (patch) | |
tree | c2631eef7e881fab8fb2cd375a24c80cbed964a7 | |
parent | Fixed opening bookmarks with multiple windows (diff) | |
download | smolbote-861084180b3f5e08d539f73876acac5326e15d64.tar.xz |
Fixed bug where the BookmarksWidget was not re-openable
-rw-r--r-- | src/forms/bookmarkswidget.cpp | 13 | ||||
-rw-r--r-- | src/forms/bookmarkswidget.h | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/forms/bookmarkswidget.cpp b/src/forms/bookmarkswidget.cpp index 8985fff..ee945cb 100644 --- a/src/forms/bookmarkswidget.cpp +++ b/src/forms/bookmarkswidget.cpp @@ -23,6 +23,17 @@ #include "browser.h" #include <QTreeWidget> +DockWidget::DockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) : + QDockWidget(title, parent, flags) +{ +} + +void DockWidget::closeEvent(QCloseEvent *event) +{ + setParent(0); + event->ignore(); +} + BookmarksWidget::BookmarksWidget(QWidget *parent) : QWidget(parent), ui(new Ui::BookmarksDialog) @@ -34,7 +45,7 @@ BookmarksWidget::BookmarksWidget(QWidget *parent) : ui->treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch); window = nullptr; - dock = new QDockWidget(tr("Bookmarks"), 0); + dock = new DockWidget(tr("Bookmarks"), 0); dock->setWidget(this); dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); diff --git a/src/forms/bookmarkswidget.h b/src/forms/bookmarkswidget.h index 9164079..ca0889b 100644 --- a/src/forms/bookmarkswidget.h +++ b/src/forms/bookmarkswidget.h @@ -26,6 +26,17 @@ #include "xbel.h" #include "mainwindow.h" +class DockWidget : public QDockWidget +{ + Q_OBJECT + +public: + explicit DockWidget(const QString &title, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()); + +protected: + void closeEvent(QCloseEvent *event); +}; + namespace Ui { class BookmarksDialog; } @@ -54,7 +65,7 @@ private slots: private: MainWindow *window; - QDockWidget *dock; + DockWidget *dock; Ui::BookmarksDialog *ui; Xbel *xbel; }; |