diff options
-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; }; |