QTextOption.setTabArray has no effekt in QTextEdit
-
Hi all,
I am trying to modify the tab positions of an QTextEdit (see the code below)
But it seems to have no effect at all. If I enter tabs ("\t") in the edit window,
they still have the standard space of 80px them.Does anyone know what I am doing wrong, or is this a bug?
@
#from PySide.QtCore import *
#from PySide.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sysclass MainWindow(QTextEdit):
def init(self, *args, **kwargs):
super(MainWindow, self).init(*args, **kwargs)opt = self.document().defaultTextOption() opt.setTabArray([100, 110, 270]) #has no effekt #opt.setTabStop(40) #this works if uncommented self.document().setDefaultTextOption(opt) print [t.position for t in self.document().defaultTextOption().tabs() ]
def main():
# Create a Qt application
app = QApplication(sys.argv)
w = MainWindow()
w.show()
app.exec_()
print repr(w.toHtml())if name == "main":
main()
@ -
This is not a problem with the Python binding. I only wrote it in python because the code is smaller. If you translate it in C++ you get the same efffect.