hi, guys. i meet some problem with QLineEdit::keyPresssEvent.It will not go to keyPressEvent when i type except ENTER/RETURN, but for other keys, it work fine.
It sounds very strange, but it just happen.
Can someone give me some advice?
This is the code:
QWidget* CVxTreeWidgetDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QWidget* editor = QItemDelegate::createEditor(parent, option, index);
QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(editor);
//bool focused = lineEdit->hasFocus(); // notice the focesed is false
//lineEdit->setFocusPolicy(Qt::StrongFocus);
//focused = lineEdit->hasFocus(); // notice setFocusPolicy is useless the focesed is false, too
if (lineEdit)
{
connect(lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinishedSignal()));
connect(lineEdit, SIGNAL(returnPressed()), this, SIGNAL(editingFinishedSignal()));
}
return editor;
}
Bookmarks