
Originally Posted by
montylee
you can use the following syntax:
connect(listWidget, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(enableDeleteButton(QListWidgetItem *)));
To copy to clipboard, switch view to plain text mode
This way, in the enableDeleteButton() function, u can access the current item from the argument.
An alternate solution is to have the button you want to enable accessible in the enableDeleteButton() function and use currentItem () to get the current item.
To make the button accesible, declare the button in the class itself (as a private variable), then you'll be able to access it in the enableDeleteButton() function.
I can't figure it out .. well, I'm new to C++ and Qt 
I changed a few things ...
{
msgDelete.setText("item is going to be removed");
int msg=msgDelete.exec();
listWidget->removeItemWidget(item);
}
connect(listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(delete_Item(QListWidgetItem*)));
void myQtApp::delete_Item(QListWidgetItem* item)
{
QMessageBox msgDelete;
msgDelete.setText("item is going to be removed");
msgDelete.setStandardButtons(QMessageBox::Yes);
int msg=msgDelete.exec();
listWidget->removeItemWidget(item);
}
To copy to clipboard, switch view to plain text mode
But the item is not removed ... probably I'm using the wrong code..
I read that QListWidget is read-only by default, I can't find out if that's true or how to change that if that's the case.
Don't mind the MessageBox in the function, I still have to implement a second button so I can choose to delete or to leave the item. The delete button I previously used is no longer valid.
Thanks for your help.
Bookmarks