Hide and resize hexdump sidebar with heuristics (#1798)

This commit is contained in:
Itay Cohen 2019-10-21 05:46:17 +03:00 committed by GitHub
parent cae07d15db
commit 3e706ffd5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -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();
}

View File

@ -33,6 +33,12 @@
<enum>Qt::Horizontal</enum>
</property>
<widget class="HexWidget" name="hexTextView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@ -51,7 +57,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>