Hide the tar bar when only one database is opened.

Closes #10
This commit is contained in:
Florian Geyer 2012-04-20 11:29:31 +02:00 committed by Felix Geyer
parent e06937287c
commit b1db565bee
2 changed files with 16 additions and 0 deletions

View File

@ -45,6 +45,19 @@ DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
connect(this, SIGNAL(currentChanged(int)), SLOT(emitEntrySelectionChanged()));
}
void DatabaseTabWidget::toggleTabbar() {
if (count() > 1) {
if (!tabBar()->isVisible()) {
tabBar()->show();
}
}
else {
if (tabBar()->isVisible()) {
tabBar()->hide();
}
}
}
void DatabaseTabWidget::newDatabase()
{
DatabaseManagerStruct dbStruct;
@ -156,6 +169,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
}
removeTab(index);
toggleTabbar();
m_dbList.remove(db);
delete dbStruct.file;
delete dbStruct.dbWidget;
@ -362,6 +376,7 @@ void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct
m_dbList.insert(db, dbStruct);
addTab(dbStruct.dbWidget, "");
toggleTabbar();
updateTabName(db);
int index = databaseIndex(db);
setCurrentIndex(index);

View File

@ -76,6 +76,7 @@ private Q_SLOTS:
void openDatabaseCleanup();
void emitEntrySelectionChanged();
void modified();
void toggleTabbar();
private:
void saveDatabase(Database* db);