From 3e706ffd5a67ed025682857cf4a00291de6a8315 Mon Sep 17 00:00:00 2001 From: Itay Cohen Date: Mon, 21 Oct 2019 05:46:17 +0300 Subject: [PATCH] Hide and resize hexdump sidebar with heuristics (#1798) --- src/widgets/HexdumpWidget.cpp | 5 +++++ src/widgets/HexdumpWidget.ui | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/widgets/HexdumpWidget.cpp b/src/widgets/HexdumpWidget.cpp index 66ff25a5..f6a96a76 100644 --- a/src/widgets/HexdumpWidget.cpp +++ b/src/widgets/HexdumpWidget.cpp @@ -307,6 +307,11 @@ void HexdumpWidget::on_hexSideTab_2_currentChanged(int /*index*/) void HexdumpWidget::resizeEvent(QResizeEvent *event) { + // Heuristics to hide sidebar when it hides the content of the hexdump. 600px looks just "okay" + // Only applied when widget width is decreased to avoid unwanted behavior + if (event->oldSize().width() > event->size().width() && event->size().width() < 600) { + showSidePanel(false); + } QDockWidget::resizeEvent(event); refresh(); } diff --git a/src/widgets/HexdumpWidget.ui b/src/widgets/HexdumpWidget.ui index e1ff895b..aa28ac15 100644 --- a/src/widgets/HexdumpWidget.ui +++ b/src/widgets/HexdumpWidget.ui @@ -33,6 +33,12 @@ Qt::Horizontal + + + 1 + 0 + + QFrame::NoFrame @@ -51,7 +57,7 @@ QTabWidget::North - 1 + 0 true