Important: Please read the Qt Code of Conduct -

Pyside6: Drop file in QTextEdit doesn't work anymore

  • Hello,

    I guess I founded a bug :

    from PySide6.QtWidgets import QApplication, QPlainTextEdit, QMainWindow, QTextEdit
    class QPlainTextEditCustom(QTextEdit):
        def __init__(self, parent):
        def dragEnterEvent(self, event):
            print("QPlainTextEditCustom dragEnterEvent")
        def dropEvent(self, event):
            print("QPlainTextEditCustom dropEvent")
    class MainWindow(QMainWindow):
        def __init__(self):
            self.MoviesSearchedTextEdit = QPlainTextEditCustom(self)
    if __name__ == '__main__':
        qApp = QApplication()
        MainWindow = MainWindow()

    Impossible to drop a file in the QTextEdit, Drag never accepted.
    Same problem with QPlainTextEdit.
    I tried with event.accept also...

    This code work with PySide2 or PyQt5.

    It's work with another widget like QPushButton or QLineEdit or QDIal...

    Any idea ?

    Thank you.

  • Lifetime Qt Champion


    Which exact version of PySide6 ?
    On which platform ?

    Just tested on Linux with 6.1.2 installed with pip and your code worked.

  • Qt : 6.1.3 and now 6.2.0
    PySide : 6.1.3 and now 6.2.0
    PySide installed with pip.
    KDE neon User Edition 5.22 (Ubuntu 20.04)

    It's OK with Qt 5.15.3

  • Lifetime Qt Champion

    System pip ?
    Virtualenv ?
    Conda ?

  • I just used :

    pip3 install pyside6
    pip3 --version
    pip 21.2.4 from /home/hizoka/.local/lib/python3.8/site-packages/pip (python 3.8)

Log in to reply