PDA

View Full Version : How to use openPersistentEditor(...) properly?



woodtluk
18th March 2010, 13:08
Hi there

In my app I created a Table which uses custom table view, table model and delegate.
In one of the columns of the table should be shown a button. I managed to set is as editor in my delegate.
But now I'd like to have the button always shown in the table.
I tried with openPersistentEditor(...) in the view. But I don't know how to use it properly.
Where and how should I call it.

Thanks for your help!
Cheers

woodtluk
22nd March 2010, 14:38
So I found a solution.

I created a slot in the table view in which I call the function openPersistentEditor(...) for every row:


void TableView::makeButtonsPersistentEditors()
{
for (int i=0; i<model()->rowCount(); i++) {
openPersistentEditor(model()->index(i, _filtersColumn, QModelIndex()));
}
}


The slot is connected with the modelReset() signal of the table model.

Cheers woodtluk