ok.. so query the db for default values...
desc <table name>;
desc <table name>;
To copy to clipboard, switch view to plain text mode
should also work then..
THANKS!
Added after 25 minutes:
SOLUTION :
int i = 0;
while (query.next()) {
if(i)
{
QString val
= query.
value(4).
toString();
if( val!= "")
{
myDataModel->setData(DataModel->index(DataModel->rowCount()-1 , i ) , val , Qt::EditRole);
}
}
i++;
}
QSqlQuery query("desc "+TableName);
int i = 0;
while (query.next()) {
if(i)
{
QString val = query.value(4).toString();
if( val!= "")
{
myDataModel->setData(DataModel->index(DataModel->rowCount()-1 , i ) , val , Qt::EditRole);
}
}
i++;
}
To copy to clipboard, switch view to plain text mode
Bookmarks