Partners
::Partners(QWidget *parent
) : ui(new Ui::Partners)
{
ui->setupUi(this);
model->setQuery("SELECT Name, City, Bulstat FROM partners");
model
->setHeaderData
(0, Qt
::Horizontal,
QObject::tr("Име"));
model
->setHeaderData
(1, Qt
::Horizontal,
QObject::tr("Град"));
model
->setHeaderData
(2, Qt
::Horizontal,
QObject::tr("ЕИК:"));
ui->tableView_partners->setModel(model);
ui->tableView_partners->setColumnWidth(0,299);
ui->tableView_partners->setColumnWidth(1,225);
ui->tableView_partners->setColumnWidth(2,225);
ui
->tableView_partners
->horizontalHeader
()->sectionResizeMode
(QHeaderView::Interactive);
ui->tableView_partners->horizontalHeader()->setStretchLastSection(true);
}
Partners::~Partners()
{
delete ui;
}
void Partners::updatePartnersTable()
{
//the code which update the table should be here
qDebug() << "updated";
}
Partners::Partners(QWidget *parent) :
QWidget(parent),
ui(new Ui::Partners)
{
ui->setupUi(this);
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("SELECT Name, City, Bulstat FROM partners");
model->setHeaderData(0, Qt::Horizontal, QObject::tr("Име"));
model->setHeaderData(1, Qt::Horizontal, QObject::tr("Град"));
model->setHeaderData(2, Qt::Horizontal, QObject::tr("ЕИК:"));
ui->tableView_partners->setModel(model);
ui->tableView_partners->setColumnWidth(0,299);
ui->tableView_partners->setColumnWidth(1,225);
ui->tableView_partners->setColumnWidth(2,225);
ui->tableView_partners->horizontalHeader()->sectionResizeMode(QHeaderView::Interactive);
ui->tableView_partners->horizontalHeader()->setStretchLastSection(true);
}
Partners::~Partners()
{
delete ui;
}
void Partners::updatePartnersTable()
{
//the code which update the table should be here
qDebug() << "updated";
}
To copy to clipboard, switch view to plain text mode
Bookmarks