1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

QuickShow: Add Fullscreen, Zoom options to View menu

This commit is contained in:
Hüseyin ASLITÜRK 2020-04-12 16:24:31 +03:00 committed by Andreas Kling
parent d79c81a179
commit e0bf57d81f
3 changed files with 44 additions and 2 deletions

View file

@ -109,6 +109,18 @@ void QSWidget::navigate(Directions direction)
this->load_from_file(m_files_in_same_dir.at(index));
}
void QSWidget::set_scale(int scale)
{
if (scale < 10)
scale = 10;
if (scale > 1000)
scale = 1000;
m_scale = scale;
relayout();
}
void QSWidget::relayout()
{
if (m_bitmap.is_null())
@ -210,12 +222,13 @@ void QSWidget::load_from_file(const String& path)
return;
}
window()->resize(bitmap->size());
m_path = path;
m_bitmap = bitmap;
m_scale = 100;
m_pan_origin = { 0, 0 };
resize_window();
if (on_scale_change)
on_scale_change(m_scale);
relayout();