]> sigrok.org Git - pulseview.git/commitdiff
DecoderOutputView: Allow for adaptive size constraints
authorSoeren Apel <redacted>
Tue, 17 Dec 2019 08:36:43 +0000 (09:36 +0100)
committerSoeren Apel <redacted>
Fri, 20 Dec 2019 00:44:21 +0000 (01:44 +0100)
pv/views/decoder_output/QHexView.cpp
pv/views/decoder_output/QHexView.hpp
pv/views/decoder_output/view.cpp
pv/views/decoder_output/view.hpp

index 82b1cd90769e6ca9c839b2b224ddad7b235f5d33..06df103b7f45c43b9aa19cc75d3e22260eace604 100644 (file)
@@ -121,6 +121,11 @@ void QHexView::showFromOffset(size_t offset)
        viewport()->update();
 }
 
+QSizePolicy QHexView::sizePolicy() const
+{
+       return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+}
+
 void QHexView::initialize_byte_iterator(size_t offset)
 {
        current_chunk_id_ = 0;
index 37b7e4e4d7394320570fb653bbd0df078f5fe241..e7c255670b7b793e014ac076c735ca34866261a6 100644 (file)
@@ -56,6 +56,7 @@ public:
 
        void clear();
        void showFromOffset(size_t offset);
+       virtual QSizePolicy sizePolicy() const;
 
 protected:
        void initialize_byte_iterator(size_t offset);
index 1f712da9be8eaf1d24d2c880e7add0c81a52944e..18cb3b449726ad19e953624d334d3f3e4fb17460 100644 (file)
@@ -53,6 +53,7 @@ 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
+       parent_(parent),
        decoder_selector_(new QComboBox()),
        format_selector_(new QComboBox()),
        class_selector_(new QComboBox()),
@@ -93,6 +94,8 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
        decoder_selector_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
        class_selector_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
 
+       parent->setSizePolicy(hex_view_->sizePolicy()); // TODO Must be updated when selected widget changes
+
        reset_view_state();
 }
 
index 7644f82a6f5c0f8703be4b262d53e64ede1d3cfa..39869d514b289b8a80d53cd11fd2b743e27b0065 100644 (file)
@@ -77,6 +77,8 @@ private Q_SLOTS:
        virtual void perform_delayed_view_update();
 
 private:
+       QWidget* parent_;
+
        QComboBox *decoder_selector_, *format_selector_, *class_selector_;
        QStackedWidget *stacked_widget_;
        QHexView *hex_view_;