diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5cf9590..eaf061e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -41,6 +41,9 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : { // set up UI ui->setupUi(this); + setDockOptions(dockOptions() | AllowTabbedDocks | ForceTabbedDocks); + setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); + setTabPosition(Qt::RightDockWidgetArea, QTabWidget::North); QMenuBar *menuBar = new QMenuBar(this); menuBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); @@ -59,6 +62,7 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : QMenu *toolsMenu = new QMenu(tr("Tools"), menuBar); menuBar->addMenu(toolsMenu); QAction *downloadsAction = toolsMenu->addAction(tr("Downloads"), Browser::instance()->downloads(), SLOT(show())); + downloadsAction->setParent(this); downloadsAction->setShortcut(QKeySequence::fromString(sSettings->value("downloads.dialogShortcut").toString())); QAction *bookmarksAction = toolsMenu->addAction(tr("Bookmarks"), Browser::instance()->bookmarks(), SLOT(show())); bookmarksAction->setParent(this); @@ -125,10 +129,27 @@ MainWindow::MainWindow(const QStringList urlList, QWidget *parent) : MainWindow::~MainWindow() { - qApp->bookmarks()->setParent(0); delete ui; } +void MainWindow::addTabbedDock(Qt::DockWidgetArea area, QDockWidget *widget) +{ + QList<QDockWidget*> allDockWidgets = findChildren<QDockWidget*>(); + QVector<QDockWidget*> areaDockWidgets; + for(QDockWidget *w : allDockWidgets) { + if(dockWidgetArea(w) == area) { + areaDockWidgets.append(w); + } + } + + if(areaDockWidgets.empty()) { + // no other widgets + addDockWidget(area, widget); + } else { + tabifyDockWidget(areaDockWidgets.last(), widget); + } +} + void MainWindow::addNewTab(const QUrl &url) { if(!url.isEmpty()) { |