Skip to content

Qt for Python

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

3.3k Topics 14.4k Posts
QtWS25 Last Chance
  • 0 Votes
    4 Posts
    75 Views
    SGaistS

    Hi and welcome to devnet,

    I think that you are looking for QGuiApplication::commitDataRequest.

  • PyQt6 minimal requirements for Ubuntu github workflow

    Solved
    6
    0 Votes
    6 Posts
    218 Views
    SGaistS

    Glad you found out and thanks for sharing !

    I did not think about this library because most of the time it happens when building C++ projects without all dependencies properly installed.

  • Defer Resize Event due to expensive resize method.

    Unsolved
    3
    0 Votes
    3 Posts
    55 Views
    S

    @AliSot2000 said in Defer Resize Event due to expensive resize method.:

    Is there a way to detect if the LMB is pressed during a ResizeEvent? Because it doesn't seem to be the case.

    Most likely resizing a (top-level) window is done by the underlying OS/window manager and thus Qt does not know anything about the mouse. This is why you only a resize event, but no mouse event. (At least, that is my guess.)

    There is a common trick using two timers, though the second timer is usually used to not delay the function call indefinitely (which you don't seem to need in your case). So, using a single timer is okay. However, you need to make sure that you reuse the same timer and reset it, so that the timeout is further delayed until there no more interactions.

  • Unable to change the background color of DockLabel

    Unsolved
    4
    0 Votes
    4 Posts
    66 Views
    B

    sorry i messed up the code in the first reply, i'm new here haha

    from PyQt5.QtWidgets import QApplication, QMainWindow from pyqtgraph.dockarea import Dock, DockArea import pyqtgraph as pg import sys class DockApp(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Dockable Display App") self.setGeometry(100, 100, 800, 600) self.area = DockArea() self.setCentralWidget(self.area) self.set_dock_default() def set_dock_default(self): """Sets up the dock with a display window.""" self.image_dock = Dock(name="Display Dock", size=(1, 1)) self.image_dock.label.setStyleSheet("background-color: #04B2E2;") #change to blu but doesn't work self.display_window = pg.PlotWidget(title="Image Display") self.display_window.getViewBox().invertY(True) # Inverting Y axis self.image_dock.addWidget(self.display_window) self.area.addDock(self.image_dock, "top") if __name__ == "__main__": app = QApplication(sys.argv) window = DockApp() window.show() sys.exit(app.exec_())
  • Help resolving PySide6 install issues on Rocky Linux 8

    Unsolved
    13
    0 Votes
    13 Posts
    249 Views
    M

    @CristianMaureira Thank you, this is exactly what I was looking for. I have no idea how I didn't find it while googling.

  • 0 Votes
    1 Posts
    45 Views
    No one has replied
  • Exchanging data between a PyQt5 app asynchronously

    Unsolved
    5
    0 Votes
    5 Posts
    130 Views
    B

    Thank you once again! I will dig into those examples.

  • simplest mvc pattern in pyside6

    Unsolved
    3
    0 Votes
    3 Posts
    218 Views
    CristianMaureiraC

    In case you need some guidance, here is an auto-translate (C++ -> Python) for the snippet within that page https://doc.qt.io/qtforpython-6/overviews/qtwidgets-model-view-programming.html (some of the code might not be 100% working but it might be hopefully a starting point)

  • 0 Votes
    4 Posts
    239 Views
    CristianMaureiraC

    Hey @dev-anis what you are trying to achieve is completely possible in PyQt6 (bindings by Riverbank Computng), but I'm not familiar how. That being said, within PySide6 (official bindings by The Qt Company) we have a tutorial for creating a SQL Alchemy PySide6 application https://doc.qt.io/qtforpython-6/tutorials/finance_manager/index.html#tutorial-financemanager where you can create a package with the deployment tool

  • How to develop python qwidget for c++ QMainWindow?

    Unsolved
    5
    0 Votes
    5 Posts
    188 Views
    CristianMaureiraC

    Hello @MonkeyBusiness
    The use case you are describing is not very usual, and that's why you might have find difficult to do it.

    As stated before, you can embed a Python interpreter within your C++ application, which can help you to have a Python interface that can interact with some of the C++ objects of your application.
    This is known as making a Qt/C++ application scriptable with Python.

    You could create a QWidget from Python, and display that like a QMessageBox, QLabel, QTreeWidget, etc, but that requires a bit more work, because that needs a runtime registration of the bindings to be generated.

    There has been some internal work on dynamic Python bindings within C++ applications, but it's not released yet.

    Like other recommendations, it seems that you can rely on .ui files for easily creating interfaces for your C++ application, rather than trying to expose python widgets to C++.

  • QSystemTrayIcon bug for computer system!!!

    Locked Unsolved
    3
    0 Votes
    3 Posts
    103 Views
    CristianMaureiraC

    And here there is the auto-translated version for Python https://doc.qt.io/qtforpython-6/overviews/qtwidgets-model-view-programming.html (please note that some issues might be present in the code snippets)

  • 0 Votes
    2 Posts
    75 Views
    CristianMaureiraC

    Officials, no, but Community driven maybe. You can check the Qt Design Studio implementation though: https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/?h=qds/dev

  • 0 Votes
    3 Posts
    96 Views
    CristianMaureiraC

    Hey @giacomos also consider looking at this old Qwt implementation of bindings: https://github.com/qt-ps-americas/pysideqwt it's not up-to-date, but it can help you with some types, for example you can see how QwtPlotCurve was exposed here: https://github.com/qt-ps-americas/pysideqwt/blob/master/bindings.xml#L13

  • Why does PySide6 need glibc 2.39 since 6.8.1 on aarch64?

    Solved
    3
    0 Votes
    3 Posts
    146 Views
    CristianMaureiraC

    The decision comes from the fact that the CI nodes for aarch64 use a higher glibc version, like @SGaist mentioned.

  • Cannot pip install pyside6_ds?

    Solved
    2
    0 Votes
    2 Posts
    101 Views
    CristianMaureiraC

    Yeah, it doesn't support 3.13 yet.
    Please make sure to report a bug in case you find anything else: https://wiki.qt.io/Qt_for_Python/Reporting_Bugs

  • 0 Votes
    3 Posts
    101 Views
    CristianMaureiraC

    Just to add to point 2.

    PyKDE seems to be very old and unmaintained.
    But, you can write KDE Apps with Python https://develop.kde.org/docs/getting-started/python/ (using Kirigami, like the C++ apps do)

  • 0 Votes
    5 Posts
    110 Views
    P

    @jsulm Thanks for replying
    Its on the main thread, called by the variable in current_queue_item var in update_progress_to_specific_queue_num() function. But the update_progress_to_specific_queue_num() is called by the signal that is emitted by the worker thread. Which is safe.

    UPDATE: I solved this problem by changing the data variable in the queue_worker.addWork() function.
    from:

    data = [f'{args["name"]} - {args["frame_name"]} - {args["size_str"]}', args]

    to:

    data = [f'{args["name"]} - {args["frame_name"]} - {args["size_str"]}', args["queue_num"]]

    I now only sent the queue_num's value, not the whole args dict. It was a dumb idea to send the whole args dict, when some of the information is not even used. Also changed a couple of code in Queue.add_to_list() item_widget var
    from

    item_widget = QueueItemWidget(item_data[0], item_data[1]["queue_num"])

    to

    item_widget = QueueItemWidget(item_data[0], item_data[1])

    and lastly in the function Queue.find_item_by_value()
    from

    if list_item.data(Qt.UserRole)["queue_num"] == value: return list_item

    to

    if list_item.data(Qt.UserRole) == value: return list_item

    But I still don't know why using the whole args dict threw an error.

  • 0 Votes
    2 Posts
    74 Views
    SGaistS

    Hi,

    Are you thinking about something like the Qt Graphs module ?
    The KDE project also has quite a lot of additional libraries.

  • 0 Votes
    2 Posts
    63 Views
    SGaistS

    Hi and welcome to devnet,

    Thanks for the detailed post and sorry I can't help you directly.
    Things that would help further:

    which version of PySide6 are you using ? which Linux distribution are you running ? which version of DBus do you have ?
  • 0 Votes
    3 Posts
    98 Views
    SGaistS

    Hi,

    Glad you found out and thanks for sharing !

    Would you mind posting the fixed version ? That might be useful to someone in the future.