I am using Qt 4.3.4. I have created a list widget having some items. I want the items to be editable so that user can modify the contents of the list widget dynamically by double clicking on the list widget item.
Here's what i am doing:
{
sampleList->editItem (item);
}
connect (sampleList, SIGNAL (itemDoubleClicked (QListWidgetItem *)), this, SLOT (test (QListWidgetItem *)));
void test (QListWidget *item)
{
sampleList->editItem (item);
}
To copy to clipboard, switch view to plain text mode
While creating the list widget items, i am setting the item flags as:
item->setFlags (item->flags () & Qt::ItemIsEditable);
item->setFlags (item->flags () & Qt::ItemIsEditable);
To copy to clipboard, switch view to plain text mode
Now, when i run my application, and double click on the list widget item to edit, i get the following error on the terminal:
Now, my query is that how can i make the list widget items editable? I tried modifying the test () function given above as:
{
sampleList->openPersistentEditor (item);
}
void test (QListWidget *item)
{
sampleList->openPersistentEditor (item);
}
To copy to clipboard, switch view to plain text mode
Using this code, i am able to edit the item but i am not sure if this is the correct way of doing it. Also, i am not sure about the usage of openPersistentEditor ().
Bookmarks