Commit bfe2d9e7 authored by Qiu Chuntao's avatar Qiu Chuntao

Add new file

parent b69d1320
#include "showtable.h"
#include "ui_showtable.h"
ShowTable::ShowTable(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ShowTable)
{
ui->setupUi(this);
}
ShowTable::~ShowTable()
{
delete ui;
}
void ShowTable::dowork(QSqlDatabase db,QString tablename)
{
QSqlTableModel *model = new QSqlTableModel(ui->tableView,db);
model->setTable(tablename);
model->select();
model->setHeaderData(0,Qt::Horizontal,QObject::tr("编号"));
model->setHeaderData(1,Qt::Horizontal,QObject::tr("usrname"));
model->setHeaderData(2,Qt::Horizontal,QObject::tr("psw"));
ui->tableView->setModel(model);
}
void ShowTable::on_close_clicked()
{
this->close();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment