mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibGUI: Fully support TabWidget in GML
TabWidgets couldn't be used in GML properly, as the GML creation routines didn't actually call the necessary functions in the TabWidget to get a new tab added. This commit fixes that by making the name of the tab a normal property, the previously introduced "title", which can be trivially set from GML. Therefore, try_add_widget() loses an argument (while try_add_tab doesn't, because it newly constructs the widget). This allows us to get rid of the silly "fixing my widget tree after the fact" code in Help and will make it super easy to use TabWidget in future GML. :^)
This commit is contained in:
parent
0410414455
commit
7e34b88ed4
7 changed files with 34 additions and 17 deletions
|
@ -61,8 +61,8 @@ DebugInfoWidget::DebugInfoWidget()
|
|||
m_backtrace_view = splitter.add<GUI::ListView>();
|
||||
auto& variables_tab_widget = splitter.add<GUI::TabWidget>();
|
||||
variables_tab_widget.set_tab_position(GUI::TabWidget::TabPosition::Bottom);
|
||||
variables_tab_widget.add_widget("Variables", build_variables_tab());
|
||||
variables_tab_widget.add_widget("Registers", build_registers_tab());
|
||||
variables_tab_widget.add_widget(build_variables_tab());
|
||||
variables_tab_widget.add_widget(build_registers_tab());
|
||||
|
||||
m_backtrace_view->on_selection_change = [this] {
|
||||
const auto& index = m_backtrace_view->selection().first();
|
||||
|
@ -132,6 +132,7 @@ RefPtr<GUI::Menu> DebugInfoWidget::get_context_menu_for_variable(const GUI::Mode
|
|||
NonnullRefPtr<GUI::Widget> DebugInfoWidget::build_variables_tab()
|
||||
{
|
||||
auto variables_widget = GUI::Widget::construct();
|
||||
variables_widget->set_title("Variables");
|
||||
variables_widget->set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
m_variables_view = variables_widget->add<GUI::TreeView>();
|
||||
|
@ -148,6 +149,7 @@ NonnullRefPtr<GUI::Widget> DebugInfoWidget::build_variables_tab()
|
|||
NonnullRefPtr<GUI::Widget> DebugInfoWidget::build_registers_tab()
|
||||
{
|
||||
auto registers_widget = GUI::Widget::construct();
|
||||
registers_widget->set_title("Registers");
|
||||
registers_widget->set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
m_registers_view = registers_widget->add<GUI::TableView>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue