mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 22:22:55 +00:00
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
This commit is contained in:
parent
4697195645
commit
0f3e57a6fb
Notes:
sideshowbarker
2024-07-19 08:54:48 +09:00
Author: https://github.com/awesomekling
Commit: 0f3e57a6fb
37 changed files with 203 additions and 246 deletions
|
@ -87,22 +87,21 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
auto widget = QSWidget::construct();
|
||||
widget->set_path(path);
|
||||
widget->set_bitmap(*bitmap);
|
||||
auto& widget = window->set_main_widget<QSWidget>();
|
||||
widget.set_path(path);
|
||||
widget.set_bitmap(*bitmap);
|
||||
|
||||
auto update_window_title = [&](int scale) {
|
||||
window->set_title(String::format("QuickShow: %s %s %d%%", widget->path().characters(), widget->bitmap()->size().to_string().characters(), scale));
|
||||
window->set_title(String::format("QuickShow: %s %s %d%%", widget.path().characters(), widget.bitmap()->size().to_string().characters(), scale));
|
||||
};
|
||||
|
||||
window->set_double_buffering_enabled(true);
|
||||
update_window_title(100);
|
||||
window->set_rect(200, 200, bitmap->width(), bitmap->height());
|
||||
|
||||
widget->on_scale_change = [&](int scale) {
|
||||
widget.on_scale_change = [&](int scale) {
|
||||
update_window_title(scale);
|
||||
};
|
||||
window->set_main_widget(widget);
|
||||
|
||||
window->show();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue