<div dir="ltr"><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">In keyPressEvent() I check the key against a list of configuraed keys to<br>
trigger one or another action. When you push a numerical key+shift, since<br>
you receive the symbol and the modifier (not the number plus the modifier,<br>
which is the defined key binding) the correspondant action can't be<br>
triggered.<br></blockquote><div><br></div><div>Looking at your code I have two suggestions.<br><br></div><div>First, write yourself a small debugging routine to show you exactly what key events you receive. (Here is one you might copy: <a href="https://github.com/tallforasmurf/PPQT/blob/master/pqMsgs.py#L383">https://github.com/tallforasmurf/PPQT/blob/master/pqMsgs.py#L383</a>) Put a call to this in your keyPressEvent method and observe what events it receives. This will be very educational, or at least, it was for me.<br>

<br></div><div>Then, I found it useful to combine the modifier and key values into single integers. If you study the list of key values and modifier values (<a href="http://qt-project.org/doc/qt-5.0/qtcore/qt.html#Key-enum">http://qt-project.org/doc/qt-5.0/qtcore/qt.html#Key-enum</a>) you see that their binary values can be combined with code such as this:<br>

<br>CTL_1 = Qt.ControlModifier | Qt.Key_1<br><br></div><div>With some reorganization of your code, you could make a dictionary using constants such as that for the key, and the corresponding object's method itself for the value, and just call the dictionary entry directly:<br>

<br></div><div>mod_key = int(event.modifiers()) | int(event.key())<br></div><div>if mod_key in self.the_dictionary :<br></div><div>    the_dictionary[mod_key]() # do the action<br></div><div>else: event.ignore()<br><br><br>

</div><div><br></div><div><br></div></div>