bool QtnPropertyDelegateQString::acceptKeyPressedForInplaceEditImpl(QKeyEvent *keyEvent) const
{
    if (QtnPropertyDelegateTyped<QtnPropertyQStringBase>::acceptKeyPressedForInplaceEditImpl(keyEvent))
        return true;

    // accept any printable key
    return qtnAcceptForLineEdit(keyEvent);
}
Пример #2
0
void qtnInitLineEdit(QLineEdit *lineEdit, QtnInplaceInfo *inplaceInfo)
{
    if (!lineEdit || !inplaceInfo)
        return;

    if (!lineEdit->isReadOnly() && (inplaceInfo->activationEvent->type() == QEvent::KeyPress))
    {
        QKeyEvent* keyEvent = static_cast<QKeyEvent*>(inplaceInfo->activationEvent);
        if (qtnAcceptForLineEdit(keyEvent))
        {
            lineEdit->setText(keyEvent->text());
            return;
        }
    }
    else
    {
        lineEdit->selectAll();
    }
}