Can't hide cursor on QTextBrowser



  • I've get the same problem in python and c++. I can't hide cursor hover a QTextBrowser. Here a simple python example :

    import sys
    
    from PyQt5.QtWidgets import QApplication, QVBoxLayout, QHBoxLayout, QTextBrowser, QPushButton, QWidget
    from PyQt5.Qt import QSpacerItem, QSizePolicy, QUrl
    from PyQt5.QtCore import Qt
    
    
    class Test(QWidget):
        
        def __init__(self):
            super().__init__()
            self.initUi()
            
        
        def initUi(self):
            v = QVBoxLayout()
            tb = QTextBrowser()
            v.addWidget(tb)
            h = QHBoxLayout()
            btn = QPushButton("close")
            btn.clicked.connect(sys.exit)
            h.addSpacerItem(QSpacerItem(10, 10, QSizePolicy.MinimumExpanding, QSizePolicy.Minimum))
            h.addWidget(btn)
            v.addLayout(h)
            self.setLayout(v) 
            
    
    if __name__ == '__main__':
        
        app = QApplication(sys.argv)
    
        w = Test()
        w.show()
        w.setCursor(Qt.BlankCursor)
        
        sys.exit(app.exec_())
    

    What's wrong ? (i try to force a setCursor(Qt.BlankCursor) on the textBrowser with the same result.)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You have to set in on your QTextEdit's view port

    tb.viewPort().setCursor(Qt.BlankCursor) if my PyQtFoo is not to rusty



  • @SGaist Thank you !! It's ok now. I missed viewport...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.