Hello guys,
I have some little troubles when deleting random items with Key_Delete. The signal/slots mechanism doesn't work like I expected.
I do the following:
QAction *delComboAction = new QAction(connectionsComboBox);
delComboAction->setShortcut(QKeySequence:

elete);
connect(delComboAction, SIGNAL(triggered()), SLOT(removeItemFromComboBox()));
and
void RssDownloader::removeItemFromComboBox()
{
if (connectionsComboBox->count() > 0 && connectionsComboBox->hasFocus()) connectionsComboBox->removeItem(connectionsComboBox->currentIndex());
}
My problems are the following:
1. The delComboAction is triggered (with a few exceptions which I will present immediately below) no matter where the current focus is and even if I assigned the parent for this QAction to be connectionsComboBox. I expected my QAction to be triggered only for my QComboBox;
2. When I expand the connectionsComboBox to see the whole list of items and select a specific one to delete, the QAction can not be triggered. It even doesn't receive any keyPressEvents. Should I reimplement the QComboBox? I would avoid as much as possible such things as they are time-consuming compared to the problem itself if there are any other "intelligent" solutions. I checked the signal highlighted(int index) emitted from connectionsComboBox and it works just fine, but it doesn't help me as I need the Delete key to work;
Does somebody know how to deal with this tricky situation?
Many thanks in advance for any kind of suggestions!
Cheers,
Victor