]> sigrok.org Git - pulseview.git/commitdiff
Use a QDockWidget to contain the view
authorSoeren Apel <redacted>
Sat, 16 Apr 2016 20:51:25 +0000 (22:51 +0200)
committerSoeren Apel <redacted>
Sun, 24 Jul 2016 09:21:09 +0000 (11:21 +0200)
pv/mainwindow.cpp
pv/mainwindow.hpp

index 2558cb07692fe497e87d262fad574bc81ad70bfd..db596c18ebe2a41d37ddc6fac107bfad9075e304 100644 (file)
@@ -42,6 +42,8 @@
 #include <QVBoxLayout>
 #include <QWidget>
 
+#include <QDockWidget>
+
 #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<pv::view::View> view = make_shared<pv::view::View>(session_, this);
+       shared_ptr<QDockWidget> dock = make_shared<QDockWidget>(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 =
index 208cbe4367e163062b59fb8fc05e6e3695da219a..6f40ef8e85a8e22a1bed9733bf03c7600ea9c4c6 100644 (file)
@@ -183,8 +183,8 @@ private:
 
        pv::view::View *view_;
 
-       QWidget *central_widget_;
-       QVBoxLayout *vertical_layout_;
+       std::map< std::shared_ptr<QDockWidget>,
+               std::shared_ptr<pv::view::View> > view_docks_;
 
        toolbars::MainBar *main_bar_;