Skip to content

Qt for Python

For discussion and questions about Qt for Python (PySide & Shiboken)

3.4k Topics 14.9k Posts
Qt 6.11 is out! See what's new in the release blog
  • Drag and Drop adding the QUrl as well as the file path in QLineEdit

    Solved
    3
    0 Votes
    3 Posts
    3k Views
    A
    @friedemannkleint Yes! Thank you! That allowed me to see that it was the "text/uri-list" data it was inserting. I ended up re-defining the Drop function for the QLineEdit class and that seemed to have done the trick! class FileDropLineEdit(QLineEdit): def __init__(self, parent=None): super().__init__(parent) def dropEvent(self, event): if event.mimeData().hasUrls(): file_path = event.mimeData().urls()[0].toLocalFile() file_path = file_path.replace("/", "\\") self.setText(file_path) event.acceptProposedAction() else: event.ignore() Since it's now its own class, I also removed the reference to the Drop event in my event filter and referenced it when creating the initial window.
  • matplotlib fails because of incomplatible qt versions

    Moved Solved
    21
    0 Votes
    21 Posts
    20k Views
    D
    The bug disappeared after qt upgrade to the version 5.15.9
  • PySide 6.5.0: Cannot load library qtquick2plugin.dll

    Unsolved qt for python pyside
    4
    0 Votes
    4 Posts
    2k Views
    D
    @friedemannkleint I tried all that, I tried different versions of virtual environments. Finally I switched over to PyQt6 and now it works flawlessly.
  • QPlainTextEdit for very large files 4+ GB.

    Unsolved
    1
    0 Votes
    1 Posts
    598 Views
    No one has replied
  • 0 Votes
    7 Posts
    2k Views
    K
    @JonB Oh now I got it! Thank you! Successfully and finally I got it fixed. Thanks again, you are just so kind!!
  • Try to change default audio output device on MacOS

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    ?
    Thanks for your help.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    58 Views
    No one has replied
  • Multi-column QML TreeView

    Unsolved pyside qt for python
    3
    0 Votes
    3 Posts
    1k Views
    D
    @kaushikv Why will I use that when QML already has a treeview and the model isn't the problem? Plus I tagged thi question as Qt for Python.
  • How to make the tip of a QSlider in PySide2 look like a triangle?

    Solved
    3
    0 Votes
    3 Posts
    950 Views
    M
    Thank you, it didn't occur to me
  • undefined symbol: qt_version_tag

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi and welcome to devnet, You should test the conda version of PyQt5. Otherwise, I would recommend that you contest the authors of PyQt to see if they are aware of that issue.
  • Is it possible to build PySide2 for M1 (arm64)?

    Unsolved pyside2
    3
    1 Votes
    3 Posts
    2k Views
    SGaistS
    Hi, Since Qt 5.15.2 contains only x86_64, one thing you can do is start a shell with the arch command so that it runs in x86_64 mode and from there follow the build instructions.
  • Updating Json without restarting

    Solved
    5
    0 Votes
    5 Posts
    2k Views
    W
    @J-Hilk Thanks for your reply, it works right now when. I had the wrong function x). Thanks for both your help and time! Have a good day Kind Regards, Bart van Wijk
  • Understand the logic of a simple pyqt5 interface inside a script

    Unsolved
    1
    0 Votes
    1 Posts
    645 Views
    No one has replied
  • QML MediaPlayer shows gstreamer pipeline in second window

    Unsolved
    1
    0 Votes
    1 Posts
    593 Views
    No one has replied
  • set maxVisibleItems property in Fusion Style for QtComboBox(dropdown box)

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    A
    Hi @Qt_Python-Learner, I know this issue is quite old, but it might still help somebody. I managed to limit the number of visible items in a Fusion style dashboard using this class: class ComboBox(QtWidgets.QComboBox): """ Modify default class of PyQT5 combobox. """ def __init__(self, parent=None): super(ComboBox, self).__init__(parent) # setMaxVisibleItems only works if the box is editable # this creates a line edit that we need to overwrite self.setEditable(True) self.setMaxVisibleItems(15) # overwrite default line edit by an invisible one self.lineEdit().setFrame(False) self.lineEdit().setReadOnly(True) def showPopup(self): """ Show pop-up. """ # set index of selected choice to highlight it text = self.lineEdit().text() index = self.findText(text, QtCore.Qt.MatchFixedString) self.setCurrentIndex(index) # show pop-up super().showPopup() # add vertical scroll bar self.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) # increase the width of the elements on popup so they can be read self.view().setMinimumWidth(self.view().sizeHintForColumn(0)) I hope this can help you or others. Cheers, Alba
  • 0 Votes
    1 Posts
    803 Views
    No one has replied
  • PySide6 QWidget Doesn't Automatically Create Window?

    Solved qt for python pyside
    4
    0 Votes
    4 Posts
    3k Views
    JonBJ
    @go4tli Indeed, it was very well spotted by @SGaist, I don't think I would have noticed it! Python could do with an override keyword to catch this, which it lacks. If you are interested for the future In Python, how do I indicate I'm overriding a method? or https://pypi.org/project/overrides/ suggest some code snippets which would catch such a mistake....
  • Python / Qt: Misbehaviour of screen reader compatibility in Ubuntu 22.04

    Unsolved
    12
    0 Votes
    12 Posts
    3k Views
    SGaistS
    Sorry for the very late reply, I tested PySide6 version 6..4.3 (installed using pip in a dedicated environment) on KDE Neon (which is based on Ubuntu 22.04 at this time) and orca 42.0-1ubuntu2 and it worked with the following test script: import sys from PySide6.QtCore import Qt from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QHBoxLayout from PySide6.QtWidgets import QLabel from PySide6.QtWidgets import QPushButton from PySide6.QtWidgets import QWidget if __name__ == "__main__": app = QApplication(sys.argv) widget = QWidget() widget.setAccessibleDescription("This is a test") label = QLabel("Test") label.setTextInteractionFlags(Qt.TextSelectableByMouse|Qt.TextSelectableByKeyboard) button = QPushButton("Test button") button.setAccessibleDescription("This is a button") button2 = QPushButton("Test button 2") button2.setAccessibleDescription("This is a second button") button2.clicked.connect(lambda: label.setText("New text")) layout = QHBoxLayout(widget) layout.addWidget(label) layout.addWidget(button) layout.addWidget(button2) widget.show() sys.exit(app.exec()) Note that I started orca on the command line and the script from another one. Note that something seems of with the QLabel. It seems not listed along the buttons however if you click on it then orca will say its content.
  • Color gradient on text

    Solved
    11
    0 Votes
    11 Posts
    5k Views
    JoeCFDJ
    @superaga It makes sense. A linear gradient needs only 2 points. Good you fixed the issue.
  • Integration of a OpenGLWidget in a QT main.window.ui using PyQT5

    Solved
    7
    0 Votes
    7 Posts
    3k Views
    P
    @JonB I changed that, by creating an empty QFrame in the mainwindow.ui, so I don't have 2 QOpenGLWidget.