Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cutie305
Starting Member
1 Post |
Posted - 2010-04-21 : 19:21:24
|
Me and some friends are working on this code, but we're missing some stuff that we have no clue how to get them to work. Any suggestions/help? Thank you. Here's the code.P.S. Scroll down to the part where it says: add_table, save_data, load_data. #include <QtGui>#include <QtSql>#include "AddressTable.h"AddressTable::AddressTable(const QString &tableName, QWidget *parent) : QDialog(parent) { model = new QSqlTableModel(this); model->setTable(tableName); model->setEditStrategy(QSqlTableModel::OnFieldChange); model->select(); model->setHeaderData(0, Qt::Horizontal, tr("ID")); model->setHeaderData(1, Qt::Horizontal, tr("First name")); model->setHeaderData(2, Qt::Horizontal, tr("Last name")); QTableView *view = new QTableView; view->setModel(model); addButton = new QPushButton(tr("&Add")); quitButton = new QPushButton(tr("Quit")); saveButton = new QPushButton(tr("&Save")); loadButton = new QPushButton(tr("&Load")); buttonBox = new QDialogButtonBox(Qt::Vertical); buttonBox->addButton(addButton, QDialogButtonBox::ActionRole); buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole); buttonBox->addButton(saveButton, QDialogButtonBox::ActionRole); buttonBox->addButton(loadButton, QDialogButtonBox::ActionRole); connect(addButton, SIGNAL(clicked()), this, SLOT(add_table())); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); connect(saveButton, SIGNAL(clicked()), this, SLOT(save_data())); connect(loadButton, SIGNAL(clicked()), this, SLOT(load_data())); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addWidget(view); mainLayout->addWidget(buttonBox); setLayout(mainLayout); setWindowTitle(tr("Address Book")); } void AddressTable::add_table() { } void AddressTable::save_data() { } void AddressTable::load_data() { } |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|