I have these connection:
connect((const QObject *)my_model, SIGNAL(beforeUpdate(int, QSqlRecord &)), this, SLOT(My_verify_record(int, QSqlRecord &)));
connect((const QObject *)my_model, SIGNAL(primeInsert(int, QSqlRecord &)), this, SLOT(My_verify_record(int, QSqlRecord &)));
To copy to clipboard, switch view to plain text mode
This is my slot definition:
void My_class
::My_verify_record(int my_row,
QSqlRecord &my_record
) {
for(int my_column = 0; my_column < my_record.count(); my_column++)
{
// Verify that current column content fulfills the field definition in PostgreSQL
}
}
void My_class::My_verify_record(int my_row, QSqlRecord &my_record)
{
for(int my_column = 0; my_column < my_record.count(); my_column++)
{
// Verify that current column content fulfills the field definition in PostgreSQL
}
}
To copy to clipboard, switch view to plain text mode
For example, if one field is defined as "NOT NULL" in PostgreSQL, I need to detect this fact inside the loop to warn the user.
Bookmarks