Could you perhaps give me some example code? I'm new at this and really confused.
UserWindow
::UserWindow(QWidget *parent
) : ui(new Ui::UserWindow)
{
//Other code here
query.exec(querystring);
model->setQuery(query);
model->removeColumn(0);
model->removeColumn(1);
model->setHeaderData(0, Qt::Horizontal, "Name");
model->setHeaderData(1, Qt::Horizontal, "Date");
model->setHeaderData(2, Qt::Horizontal, "Completed");
// Populate the table with the relevant information from the database
ui->tableView->setModel(model);
ui->tableView->show();
}
void UserWindow::on_NextButton_clicked()
{
// What do I do here?
// I want the value within the currently selected cell to be used here.
// Could someone give me some example code to demonstrate how to do this.
}
UserWindow::UserWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::UserWindow)
{
//Other code here
query.exec(querystring);
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery(query);
model->removeColumn(0);
model->removeColumn(1);
model->setHeaderData(0, Qt::Horizontal, "Name");
model->setHeaderData(1, Qt::Horizontal, "Date");
model->setHeaderData(2, Qt::Horizontal, "Completed");
// Populate the table with the relevant information from the database
ui->tableView->setModel(model);
ui->tableView->show();
}
void UserWindow::on_NextButton_clicked()
{
QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
// What do I do here?
// I want the value within the currently selected cell to be used here.
// Could someone give me some example code to demonstrate how to do this.
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks