summaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/common/dbcombobox.cpp
blob: 303a37a82618283e97ad4537517e8108b1dbd4ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "dbcombobox.h"
#include "dblistmodel.h"
#include "db/db.h"

DbComboBox::DbComboBox(QWidget* parent) : QComboBox(parent)
{
    dbComboModel = new DbListModel(this);
    dbComboModel->setCombo(this);
    setModel(dbComboModel);
    setEditable(false);
}

DbListModel* DbComboBox::getModel() const
{
    return dbComboModel;
}

void DbComboBox::setCurrentDb(Db* db)
{
    setCurrentIndex(dbComboModel->getIndexForDb(db));
}

Db* DbComboBox::currentDb() const
{
    return dbComboModel->getDb(currentIndex());
}