Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. QTextOption.setTabArray has no effekt in QTextEdit
Qt 6.11 is out! See what's new in the release blog

QTextOption.setTabArray has no effekt in QTextEdit

Scheduled Pinned Locked Moved Language Bindings
3 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kochelmonster
    wrote on last edited by
    #1

    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 sys

    class 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()
    @

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tucnak
      wrote on last edited by
      #2

      Oh, no. Are you all conspired?

      Moderator will move this post to the "Bindings" forum. It's Genaral & Desktop - here only C++ questions! Your code written in Python - it means that you need to post it into Language Binidings forum.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kochelmonster
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved