PDA

View Full Version : Could you help to customize my model ??



advseo32
22nd July 2013, 17:09
Hi, every body

i have a probleme with inserting a row from a table call tableProduct to another table call tableSalle

when the user click entre key in the first table “tableProduct”

i can’t figured out, how this work

this is an image explains what i means

9327

i think we implement insertrow function


bool MyModel::insertRows(int position, int rows, const QModelIndex &parent)
{
beginInsertRows(QModelIndex(), position, position+rows-1);
// i want to get the event when the user click "Keydown"
if (true)
{
// we add row with empty fields to allow user to fill them
}


endInsertRows();
return true;
}

rockdemon
24th July 2013, 09:24
you need to implement the editrole then use that to insert the data into your underlying model calling reset on the model to force the update to the screen.

advseo32
24th July 2013, 17:11
you need to implement the editrole then use that to insert the data into your underlying model calling reset on the model to force the update to the screen.

can you give me an example ??

rockdemon
25th July 2013, 09:10
nothing that isnt proprietary. If i get time i'll knock something up later.