From 25272feeeffbf2f67645a7be29ac8704c41c1bb0 Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Sat, 16 Apr 2016 22:51:25 +0200 Subject: [PATCH] Use a QDockWidget to contain the view --- pv/mainwindow.cpp | 19 ++++++++++--------- pv/mainwindow.hpp | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 2558cb0..db596c1 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -42,6 +42,8 @@ #include #include +#include + #include "mainwindow.hpp" #include "devicemanager.hpp" @@ -73,6 +75,7 @@ using std::cerr; using std::endl; using std::list; +using std::make_shared; using std::map; using std::max; using std::pair; @@ -356,16 +359,14 @@ void MainWindow::setup_ui() icon.addFile(QString(":/icons/sigrok-logo-notext.svg")); setWindowIcon(icon); - // Setup the central widget - central_widget_ = new QWidget(this); - vertical_layout_ = new QVBoxLayout(central_widget_); - vertical_layout_->setSpacing(6); - vertical_layout_->setContentsMargins(0, 0, 0, 0); - setCentralWidget(central_widget_); - - view_ = new pv::view::View(session_, this); + // Set up the initial view + shared_ptr view = make_shared(session_, this); + shared_ptr dock = make_shared(tr("Untitled"), this); + dock->setWidget(view.get()); + addDockWidget(Qt::TopDockWidgetArea, dock.get()); + view_docks_[dock] = view; - vertical_layout_->addWidget(view_); + view_ = view.get(); // view_ will be refactored later // Setup the menu bar pv::widgets::HidingMenuBar *const menu_bar = diff --git a/pv/mainwindow.hpp b/pv/mainwindow.hpp index 208cbe4..6f40ef8 100644 --- a/pv/mainwindow.hpp +++ b/pv/mainwindow.hpp @@ -183,8 +183,8 @@ private: pv::view::View *view_; - QWidget *central_widget_; - QVBoxLayout *vertical_layout_; + std::map< std::shared_ptr, + std::shared_ptr > view_docks_; toolbars::MainBar *main_bar_; -- 2.30.2