waynew
17th April 2010, 02:30
Opening a dialog from the main window menu and I need to pass a QSqlRecord to it.
I have the record value, and I suspect the answer is signals & slots.
I can make the slot in the dialog, but what would the signal from the main window be?
I'm still having trouble grasping the full power of signals & slots.
Here is what I have so far.
void MainWindow::on_actionEdit_Log_Entry_triggered()
{
if (::open_log != "") {
QModelIndex index = view->currentIndex();
QSqlRecord record;
int i = index.row();
record = model->record(i);
qDebug() << "record is " << record; // record looks good, need to pass it.
EditLog *edit = new EditLog(this);
edit->show();
}else{
QMessageBox::information(this, "Edit Log", tr("A log must be open to edit it."));
}
}
Any help please?
I have the record value, and I suspect the answer is signals & slots.
I can make the slot in the dialog, but what would the signal from the main window be?
I'm still having trouble grasping the full power of signals & slots.
Here is what I have so far.
void MainWindow::on_actionEdit_Log_Entry_triggered()
{
if (::open_log != "") {
QModelIndex index = view->currentIndex();
QSqlRecord record;
int i = index.row();
record = model->record(i);
qDebug() << "record is " << record; // record looks good, need to pass it.
EditLog *edit = new EditLog(this);
edit->show();
}else{
QMessageBox::information(this, "Edit Log", tr("A log must be open to edit it."));
}
}
Any help please?