mam taki kod
bool MySqlQueryModel::insertRows(int position, int rows, const QModelIndex &index)
{
Q_UNUSED(index);
beginInsertRows(QModelIndex(), position, position + rows - 1);
for (int row = 0; row < rows; ++row){
qDebug()<<"wiersz" << rows;
}
endInsertRows();
return true;
}
//! [4]
//! [5]
bool MySqlQueryModel::removeRows(int position, int rows, const QModelIndex &index)
{
Q_UNUSED(index);
beginRemoveRows(QModelIndex(), position, position + rows - 1);
for (int row = 0; row < rows; ++row){
}
endRemoveRows();
return true;
}
void MySqlQueryModel::addRow()
{
insertRows(0,1,QModelIndex());
qDebug()<< "dodaję wiersz";
}
void MySqlQueryModel::remRow()
{
removeRows(0,1,QModelIndex());
qDebug()<< "usuwam wiersz";
}
Czy ktoś z was będzie wiedział jak zrobić aby wiersze się dodawały i usuwały ? W sumie się dodają i usuwają ale to za sprawą dwóch funkcji addRow
i remRow
ale nie dodają się rekordy do bazy. czy coś trzeba jeszcze zrobić ?