C++ (Qt)
class ListView : public QListView
{
Q_OBJECT
signals:
void removeRow(int);
protected:
void mouseReleaseEvent(QMouseEvent *event) {
QListView::mouseReleaseEvent(event);
if (event->button() == Qt::RightButton) {
emit removeRow(this->selectionModel()->selectedRows().first().row());
}
}
};
C++ (Qt)
QCompleter *completer = new QCompleter(completerWords, this);
ListView *listView = new ListView;
connect(listView, SIGNAL(removeRow(int)), this, SLOT(removeRow(int)));
completer->setPopup(listView);
completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
completer->setMaxVisibleItems(10);
ui->lineEdit->setCompleter(completer);
void Gui::removeRow(int row)
{
ui->lineEdit->completer()->model()->removeRow(row);
ui->lineEdit->completer()->complete();
}