Correctly show normal-sized preview after returning from a very wide one

If the height had been reduced due to a very wide window being shown,
it was not reset to its full value when switching back to a more
narrow preview. Fix this by relayouting the window.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
This commit is contained in:
Markus Himmel 2015-07-26 11:21:30 +00:00 committed by Augustin Cavalier
parent d682f9fc9c
commit e4eecdb5c0

View File

@ -239,7 +239,6 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent,
saveScreenshot->MakeDefault(true);
Layout(false);
_UpdatePreviewPanel();
_UpdateFilenameSelection();
@ -440,6 +439,11 @@ ScreenshotWindow::_NewScreenshot(bool silent, bool clipboard)
void
ScreenshotWindow::_UpdatePreviewPanel()
{
// Set the height of fPreview to what the layout suggests
fPreview->SetExplicitMinSize(BSize());
fPreview->SetExplicitMaxSize(BSize());
Layout(false);
float height = fPreview->Bounds().Height();
float width = (fScreenshot->Bounds().Width()
/ fScreenshot->Bounds().Height()) * height;