python - How to change the characters used for QTextOption.ShowTabsAndSpaces? -
is there way change character used qt's qtextoption.showtabsandspaces
flag?
i find default character that's used viewing whitespace (specifically spaces) stands out little much. i'd change font or character used it's less distinct.
it looks character used unicode "middle dot", ·
(u+00b7) , i'd use, say, u+02d1 ˑ
.
ideally i'd able set whatever user wants.
i've been searching through qt docs , have been able find how turn flag on (here).
edit:
i guess should show code... here's how i'm adding whitespace indicators:
opts = self.document().defaulttextoption() opts.setflags(opts.flags() | qtextoption.showtabsandspaces) self.document().setdefaulttextoption(opts)
running python 3.4 , pyqt4, should able port c++ code over.
edit2:
thanks andrei shikalev's answer below, i've posted feature request on qt tracker: https://bugreports.qt.io/browse/qtbug-46072
currently not change characters tabs , white space. characters hardcoded in qt source qtextlayout:
qchar visualtab(0x2192); ... qchar visualspace((ushort)0xb7);
more info in source qtextlayout on github.
you can create feature request tabs , white spaces custom characters. imho feature useful custom-looking editors, based on qt.
Comments
Post a Comment