Not capturing keyboard shortcut keys in QT event filter (that forces text to upper case)
<p>In Qt 5.6, I set up an event filter to force text entered by the user in QLineEdits and QTextEdits to upper case.<br>
Context menu functions (copy, paste) work but the keyboard shortcuts do not.</p>

<p>Seems that I also capture control-shifted letters (ctrl-C, ctrl-V, etc.).</p>

<p>What am I not doing to exclude the control-shifted keys so that they get processed normally?</p>

<p>Code snippet below.</p>

<pre><code>bool Form::eventFilter(QObject *obj, QEvent *event)
{
    if(event-&gt;type() == QEvent::KeyPress)
    {
        QKeyEvent *keyEvent = static_cast&lt;QKeyEvent*&gt;(event);
        if(keyEvent-&gt;key() &gt;= Qt::Key_A &amp;&amp; keyEvent-&gt;key() &lt;= Qt::Key_Z &amp;&amp;
            ((keyEvent-&gt;modifiers() &amp; Qt::ShiftModifier) == false))
        {
             QApplication::sendEvent(obj, new QKeyEvent(QEvent::KeyPress,
                keyEvent-&gt;key(), keyEvent-&gt;modifiers() | Qt::ShiftModifier,
                keyEvent-&gt;text().toUpper()));
            QApplication::sendEvent(obj, new QKeyEvent(QEvent::KeyRelease,
                keyEvent-&gt;key(), keyEvent-&gt;modifiers() | Qt::ShiftModifier,
                keyEvent-&gt;text().toUpper()));
            return true;
        }else return false;
    }
    return false;
}
</code></pre>