When using the QPlaintextEdit in PyQt5, if I press the Tab button on my keyboard I get a tab space which is equal to size of six spaces together. But I want it to be the size of four spaces, so that when I use:
TextEdit.setPlainTextEdit('\t')
I should get a indentation of a tab space, which is as long as four spaces altogether.
I tried using four spaces instead of a tab space, but things got complex, as code became more lengthy.
QFontMetrics::width()
is deprecated (since Qt-5.11 I believe). It's recommended to useQFontMetricsF::horizontalAdvance()
instead from now on. – Royall