mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 16:33:13 +00:00
SQLStudio: Add collapsible tabs for query results
Adds tabs under the editor and places the query results there. It is only displayed if there are results to an executed query.
This commit is contained in:
parent
e9541bca31
commit
f33979a753
Notes:
sideshowbarker
2024-07-17 09:49:45 +09:00
Author: https://github.com/martinfalisse
Commit: f33979a753
Pull-request: https://github.com/SerenityOS/serenity/pull/14196
Reviewed-by: https://github.com/linusg
2 changed files with 16 additions and 6 deletions
|
@ -191,6 +191,19 @@ MainWidget::MainWidget()
|
|||
on_editor_change();
|
||||
};
|
||||
|
||||
m_action_tab_widget = add<GUI::TabWidget>();
|
||||
m_action_tab_widget->set_fixed_height(0);
|
||||
m_action_tab_widget->set_close_button_enabled(true);
|
||||
|
||||
m_query_results_widget = m_action_tab_widget->add_tab<GUI::Widget>("Results");
|
||||
m_query_results_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
m_query_results_widget->layout()->set_margins(6);
|
||||
m_query_results_table_view = m_query_results_widget->add<GUI::TableView>();
|
||||
|
||||
m_action_tab_widget->on_tab_close_click = [this](auto&) {
|
||||
m_action_tab_widget->set_fixed_height(0);
|
||||
};
|
||||
|
||||
m_statusbar = add<GUI::Statusbar>(3);
|
||||
|
||||
m_statusbar->segment(1).set_mode(GUI::Statusbar::Segment::Mode::Fixed);
|
||||
|
@ -199,11 +212,6 @@ MainWidget::MainWidget()
|
|||
m_statusbar->segment(2).set_mode(GUI::Statusbar::Segment::Mode::Fixed);
|
||||
m_statusbar->segment(2).set_fixed_width(font().width("Ln 0000, Col 000") + font().max_glyph_width());
|
||||
|
||||
m_query_results_widget = add<GUI::GroupBox>("Results");
|
||||
m_query_results_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
m_query_results_widget->layout()->set_margins(6);
|
||||
m_query_results_table_view = m_query_results_widget->add<GUI::TableView>();
|
||||
|
||||
m_sql_client = SQL::SQLClient::try_create().release_value_but_fixme_should_propagate_errors();
|
||||
m_sql_client->on_execution_success = [this](int, bool, int, int, int) {
|
||||
read_next_sql_statement_of_editor();
|
||||
|
@ -227,6 +235,7 @@ MainWidget::MainWidget()
|
|||
individual_result_as_json.append(result_row_column);
|
||||
query_results_model->add(move(individual_result_as_json));
|
||||
}
|
||||
m_action_tab_widget->set_fixed_height(200);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue