From: Soeren Apel Date: Sat, 16 Apr 2016 20:51:25 +0000 (+0200) Subject: Use a QDockWidget to contain the view X-Git-Tag: pulseview-0.4.0~282 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=25272feeeffbf2f67645a7be29ac8704c41c1bb0;p=pulseview.git Use a QDockWidget to contain the view --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 2558cb07..db596c18 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 208cbe43..6f40ef8e 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_;