mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
QuickShow: Switch to full screen mode on double click
More respect to user behavior on image viewers :)
This commit is contained in:
parent
016fc9c133
commit
bf3d98012a
3 changed files with 12 additions and 2 deletions
|
@ -160,6 +160,11 @@ void QSWidget::resize_event(GUI::ResizeEvent& event)
|
||||||
GUI::Widget::resize_event(event);
|
GUI::Widget::resize_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QSWidget::doubleclick_event(GUI::MouseEvent&)
|
||||||
|
{
|
||||||
|
on_doubleclick();
|
||||||
|
}
|
||||||
|
|
||||||
void QSWidget::paint_event(GUI::PaintEvent& event)
|
void QSWidget::paint_event(GUI::PaintEvent& event)
|
||||||
{
|
{
|
||||||
Frame::paint_event(event);
|
Frame::paint_event(event);
|
||||||
|
|
|
@ -57,10 +57,12 @@ public:
|
||||||
void load_from_file(const String&);
|
void load_from_file(const String&);
|
||||||
|
|
||||||
Function<void(int)> on_scale_change;
|
Function<void(int)> on_scale_change;
|
||||||
|
Function<void()> on_doubleclick;
|
||||||
Function<void(const GUI::DropEvent&)> on_drop;
|
Function<void(const GUI::DropEvent&)> on_drop;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSWidget();
|
QSWidget();
|
||||||
|
virtual void doubleclick_event(GUI::MouseEvent&) override;
|
||||||
virtual void paint_event(GUI::PaintEvent&) override;
|
virtual void paint_event(GUI::PaintEvent&) override;
|
||||||
virtual void resize_event(GUI::ResizeEvent&) override;
|
virtual void resize_event(GUI::ResizeEvent&) override;
|
||||||
virtual void mousedown_event(GUI::MouseEvent&) override;
|
virtual void mousedown_event(GUI::MouseEvent&) override;
|
||||||
|
|
|
@ -103,6 +103,10 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
widget.on_doubleclick = [&] {
|
||||||
|
window->set_fullscreen(!window->is_fullscreen());
|
||||||
|
toolbar_container.set_visible(!window->is_fullscreen());
|
||||||
|
};
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
auto open_action = GUI::CommonActions::make_open_action(
|
auto open_action = GUI::CommonActions::make_open_action(
|
||||||
|
@ -192,8 +196,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto full_sceen_action = GUI::CommonActions::make_fullscreen_action(
|
auto full_sceen_action = GUI::CommonActions::make_fullscreen_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
window->set_fullscreen(!window->is_fullscreen());
|
widget.on_doubleclick();
|
||||||
toolbar_container.set_visible(!window->is_fullscreen());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
auto zoom_in_action = GUI::Action::create("Zoom In", { Mod_None, Key_Plus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"),
|
auto zoom_in_action = GUI::Action::create("Zoom In", { Mod_None, Key_Plus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue