Mercurial > octave
changeset 23943:f5b81e587bb5
only enable toolbar of variable editor if a tab is present
* variable-editor.cc (construct_tool_bar): disable toolbar at start up;
(edit_variable): enable toolbar if new tab is the first one;
(closeTab): disable toolbar if closed tab was the last one
author | Torsten <mttl@mailbox.org> |
---|---|
date | Fri, 25 Aug 2017 20:49:04 +0200 |
parents | 9c736cc2ee94 |
children | 0bc54dbc2bfc |
files | libgui/src/variable-editor.cc |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/variable-editor.cc Sun Aug 13 11:41:02 2017 +0200 +++ b/libgui/src/variable-editor.cc Fri Aug 25 20:49:04 2017 +0200 @@ -180,6 +180,8 @@ (QIcon (":/actions/icons/arrow_up.png"), tr ("Up"), this, SLOT (up ())); + + tool_bar->setEnabled (false); // Disabled when no tab is present } /*variable_editor::~variable_editor () @@ -265,6 +267,10 @@ page->setProperty ("data", QVariant::fromValue (table_data (table))); int tab_idx = tab_widget->addTab (page, name); tab_widget->setCurrentIndex (tab_idx); + + if (tab_widget->count () == 1) + tool_bar->setEnabled (true); // This is the first tab -> enable tool bar + if (autofit) { table->resizeColumnsToContents(); @@ -326,6 +332,10 @@ QWidget *const wdgt = tab_widget->widget (idx); tab_widget->removeTab (idx); delete wdgt; + + if (tab_widget->count () == 0) + tool_bar->setEnabled (false); // This was the last tab -> disable tool bar + } void