From: Soeren Apel Date: Wed, 27 Nov 2019 19:51:19 +0000 (+0100) Subject: Change parameter to ViewBase constructor X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a24412db987328f80cf32d8299d82b72a441c239;p=pulseview.git Change parameter to ViewBase constructor --- diff --git a/pv/views/decoder_output/view.cpp b/pv/views/decoder_output/view.cpp index e6e42cbb..28fe907e 100644 --- a/pv/views/decoder_output/view.cpp +++ b/pv/views/decoder_output/view.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include "view.hpp" @@ -36,7 +37,7 @@ namespace pv { namespace views { namespace decoder_output { -View::View(Session &session, bool is_main_view, QWidget *parent) : +View::View(Session &session, bool is_main_view, QMainWindow *parent) : ViewBase(session, is_main_view, parent) // Note: Place defaults in View::reset_view_state(), not here @@ -44,6 +45,11 @@ View::View(Session &session, bool is_main_view, QWidget *parent) : QVBoxLayout *root_layout = new QVBoxLayout(this); root_layout->setContentsMargins(0, 0, 0, 0); + QToolBar* tool_bar = new QToolBar(); + tool_bar->setContextMenuPolicy(Qt::PreventContextMenu); + + parent->addToolBar(tool_bar); + reset_view_state(); } diff --git a/pv/views/decoder_output/view.hpp b/pv/views/decoder_output/view.hpp index a780c2f3..a4db819e 100644 --- a/pv/views/decoder_output/view.hpp +++ b/pv/views/decoder_output/view.hpp @@ -35,7 +35,7 @@ class View : public ViewBase Q_OBJECT public: - explicit View(Session &session, bool is_main_view=false, QWidget *parent = nullptr); + explicit View(Session &session, bool is_main_view=false, QMainWindow *parent = nullptr); ~View(); diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index 668ebb70..8c2b37b8 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -124,7 +124,7 @@ bool CustomScrollArea::viewportEvent(QEvent *event) } } -View::View(Session &session, bool is_main_view, QWidget *parent) : +View::View(Session &session, bool is_main_view, QMainWindow *parent) : ViewBase(session, is_main_view, parent), // Note: Place defaults in View::reset_view_state(), not here diff --git a/pv/views/trace/view.hpp b/pv/views/trace/view.hpp index 82a2f728..b0cf0260 100644 --- a/pv/views/trace/view.hpp +++ b/pv/views/trace/view.hpp @@ -100,7 +100,7 @@ private: static const int ScaleUnits[3]; public: - explicit View(Session &session, bool is_main_view=false, QWidget *parent = nullptr); + explicit View(Session &session, bool is_main_view=false, QMainWindow *parent = nullptr); ~View(); diff --git a/pv/views/viewbase.cpp b/pv/views/viewbase.cpp index a4dc5490..69be61c8 100644 --- a/pv/views/viewbase.cpp +++ b/pv/views/viewbase.cpp @@ -42,7 +42,7 @@ const char* ViewTypeNames[ViewTypeCount] = { const int ViewBase::MaxViewAutoUpdateRate = 25; // No more than 25 Hz -ViewBase::ViewBase(Session &session, bool is_main_view, QWidget *parent) : +ViewBase::ViewBase(Session &session, bool is_main_view, QMainWindow *parent) : // Note: Place defaults in ViewBase::reset_view_state(), not here QWidget(parent), session_(session), diff --git a/pv/views/viewbase.hpp b/pv/views/viewbase.hpp index 0c7b0463..3d43ca9a 100644 --- a/pv/views/viewbase.hpp +++ b/pv/views/viewbase.hpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -69,7 +70,7 @@ private: static const int MaxViewAutoUpdateRate; public: - explicit ViewBase(Session &session, bool is_main_view = false, QWidget *parent = nullptr); + explicit ViewBase(Session &session, bool is_main_view = false, QMainWindow *parent = nullptr); /** * Resets the view to its default state after construction. It does however