Hi.
I want to know how to make sure that I wont can let some cell of my view empty.
For example I doubleclicked cell and started write. I rite something and than I press enter or tab or arrow. But when I write nothing, when I let the cell empty and press enter or tab or narrow or click somewhere I want to application set the empty cell as current and call edit().
It sounds pretty easy but I dont know which signal may i use. I tried to use dataChanged with top and bottom modelindexes but it doesnt work and I dont know why. Thisi im the code:
{
if(!top.isValid())
return;
data = top.data().toString();
if (data.isEmpty())
{
view->setCurrentIndex(top);
view->edit(top);
}
void DB::dataChanged(const QModelIndex &top, const QModelIndex &bottom)
{
if(!top.isValid())
return;
QString data;
data = top.data().toString();
if (data.isEmpty())
{
view->setCurrentIndex(top);
view->edit(top);
}
To copy to clipboard, switch view to plain text mode
I tried some other signals from QTableView and QSqlTableModel but nothing works perfectly for me.
Can anyone help me?
Bookmarks