While searching for a solution to tabbing through QTableWidgets in PyQt, I found this old question on StackOverflow that needed help creating the code necessary to allow a QTextEdit to capture Shift-tab to deindent code.

Below is the thoroughly commented code that explains how all this works:

Soon another Canard update, and the next exciting installment in the XForms tutorial!