From 49180a6495d76e30e8ba4c8075534599b8cbd823 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Wed, 4 Mar 2015 13:14:59 +0100 Subject: [PATCH] hide tabs if not used --- src/core/settingsdialog.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/settingsdialog.cpp b/src/core/settingsdialog.cpp index cec4eb3..d6d8da6 100644 --- a/src/core/settingsdialog.cpp +++ b/src/core/settingsdialog.cpp @@ -57,7 +57,15 @@ void SettingsDialog::initTabs() enabled = true; } } - ui->tabWidget->setTabEnabled(ui->tabWidget->indexOf(container), enabled); + if (enabled) { + if (ui->tabWidget->indexOf(container) == -1) { + ui->tabWidget->addTab(container,container->property("TAB_NAME").toString()); + } + } else { + int index = ui->tabWidget->indexOf(container); + container->setProperty("TAB_NAME", ui->tabWidget->tabText(index)); + ui->tabWidget->removeTab(index); + } }; addWidgets(ui->tabWidget_backends, ui->tab_backends, SnorePlugin::BACKEND); addWidgets(ui->tabWidget_secondary_backends, ui->tab_secondaryBackends, SnorePlugin::SECONDARY_BACKEND);