Skip to content

Qt for Python

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

3.3k Topics 14.5k Posts
  • Debugging segfaults

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    S
    @IDontKnowHowToCode , thanks for the reference, I'll try faulthandler next time. But actually it was never a problem to find a line of code that raises segmentation violation it rather a problem to understand why it happens there. Thinking about your problem I would suspect that you may store a reference to delegate in some local variable that is cleaned before your window is closed (or not store it at all). This way you may still have a TreeView displayed by python garbage collector may have killed the delegate already. I.e. check that scope of your delegate variable matches the scope of your TreeView which it serves for.
  • how to set system environment variables for Visual Studio 2022 C++ compiler

    Unsolved
    2
    0 Votes
    2 Posts
    3k Views
    S
    You first screenshot says: [ERROR: vcvarsall.bat] Error in script usage. You need to specify the arch for this script to do anything at all. Most likely you want to call vcvarsall.bat amd64 to compile for 64-bit.
  • How do I draw a HUD Overlay for another window

    Unsolved
    2
    0 Votes
    2 Posts
    356 Views
    SGaistS
    Hi, If you want to do that in some kind of overlay, then you can create a new transparent widget that you put on top of your main widget.
  • A problem with displaying data in a tableView

    Unsolved
    4
    0 Votes
    4 Posts
    601 Views
    JonBJ
    @MIckH It was only an "OMG" moment for me because I had not spotted the PyQt5/PyQt6 mixture earlier :)
  • The CXX compiler identification is unknown

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    N
    @jsulm Yes I did and I set it to the compiler property in Preferences > Kits > Compilers Did I do wrong in those things? [image: 0835067f-e811-4a2a-86e1-31ae59c790f5.png]
  • 0 Votes
    5 Posts
    2k Views
    WolleKetteW
    @SGaist No, if I convert the QPixmap to a QImage, then it works without problems. Also under the older PySide6 version. Here is the code if someone has the same problem... pixmap = self.grab() image = pixmap.toImage() clipboard = QApplication.clipboard() clipboard.setImage(image)
  • qt for python example

    Unsolved
    2
    0 Votes
    2 Posts
    205 Views
    SGaistS
    Hi, Without the current code you use, it becomes really hard to answer.
  • Manually emiting errorOcurred

    Unsolved
    3
    0 Votes
    3 Posts
    242 Views
    O
    @JonB Hi, thanks for answering, yes I thought about some custom signals with a QProcess subclass. But then this would assume that the process scheduler knows the specific details about the subclass and it loses a bit of generality. In any case, it looks like this is the way. Thanks again.
  • QDataWidgetMapper how to clear mapped widgets when model is empty

    Unsolved
    20
    0 Votes
    20 Posts
    1k Views
    S
    @JonB I respect your summary and I think it is a correct one. But let me disagree with you about QDataWidgetMapper behavior. I have nothing against "KISS" but the behavior should be also consistent and clear. As I see it is: A) inconsistent - as for some datatypes we have a mapping for NULL and for others have not. There might be different views but down to underlying bits - empty string and NULL are not the same values, so here we definitely have an adaptation and translation. But we don't have it for integer. B) unclear - the documentation says nothing about someting won't be updated. There are only this text "Every time the current index changes, each widget is updated with data from the model via the property specified when its mapping was made." So it is always a surprise that calls for some kind of ad-hoc workarounds (instead of a proper design). Summarizing - I think the best what should be done: all datatypes should be treated equally (either with some translation or ingnoring NULL for all of them). documentation should have a clear statement about how it actually works. I think I should update my bug reports with this kind of proposal.
  • DeprecationWarning QSqlQueryModel.setQuery

    Unsolved qt for python python pyside
    10
    0 Votes
    10 Posts
    1k Views
    SGaistS
    Thanks !
  • Can't set the model data in tableview

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    JonBJ
    @MIckH Now I can indeed spot what is wrong in your code! See your duplicate thread and my answer in https://forum.qt.io/topic/146638/a-problem-with-displaying-data-in-a-tableview/5. Please do not continue this thread as well as that one.....
  • Using pyside2-lupdate to update strings in .ts file

    Solved
    4
    0 Votes
    4 Posts
    624 Views
    J
    @CristianMaureira I have updated the whole application to PySide6 and now it generates well the .ts file with UTF8 encoding and updating correctly the text strings. Thank you very much!
  • QDataWidgetMapper addMapping to propertyName

    Solved
    2
    0 Votes
    2 Posts
    365 Views
    B
    Okay, I think I've figured it out. I remember the docs mentioned 'user property' but I glossed over it. Turns out I didn't understand what a QtCore.Property was. Here's relevant docs: https://doc-snapshots.qt.io/qtforpython-dev/PySide6/QtCore/Property.html Here's a working subclassed combo example that uses a custom property. from PySide6.QtCore import Property from PySide6.QtWidgets import QComboBox class MyCombo(QComboBox): def __init__(self, parent=None): super().__init__(parent=parent) def readXyz(self): print("read xyz called") return self.currentIndex() def setXyz(self, i): print("set xyz called") self.setCurrentIndex(i) xyz = Property(int, readXyz, setXyz) Or a more pythonic(?) version of property getters and setters that I'm used to: from PySide6.QtCore import Property from PySide6.QtWidgets import QComboBox class MyCombo(QComboBox): @Property(int) def xyz(self): print("read xyz called") return self.currentIndex() @xyz.setter def xyz(self, i): print("set xyz called") self.setCurrentIndex(i)
  • QSlider color

    Unsolved
    2
    0 Votes
    2 Posts
    353 Views
    JonBJ
    @Captain-Haddock Try setting the stylesheet on the slider. I think per https://doc.qt.io/qt-6/stylesheet-examples.html#customizing-qslider you need to select the ::groove?
  • pyside6-designer launcher is absent

    Solved
    17
    0 Votes
    17 Posts
    7k Views
    S
    Hi @CristianMaureira, yes this is clear. But it is much more convenient to have all your packages managed by a single packet manager. This is the reason why I prefer to use system-specific packages in case of Arch. So as result Arch package was improved and I think it is an acceptable outcome.
  • Qt for Python - closed-source application as single executable?

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    CristianMaureiraC
    @ALIENQuake check the scriptableapplication example. It's a Qt/C++ application that includes a Python interpreter, so you can access some of the Qt C++ objects from Python. Then it will be a matter of how you compile/package your app. If you app follows LGPL, then you need to make the code available. If you hold a Qt Commercial license, then you can not make the code available and distribute the application.
  • pyside6-project.exe existed with code 1

    Unsolved
    4
    0 Votes
    4 Posts
    361 Views
    CristianMaureiraC
    @Jason_Au pyside6-project didn't exist in 5.15 I wonder if maybe you are mixing pyside versions and that might cause the issue?
  • cant update matplotlib canvas with new data

    Moved Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    CristianMaureiraC
    @Allaye not sure if it helps, but maybe you can check other examples, like https://doc.qt.io/qtforpython-6/examples/example_external_matplotlib_widget3d.html to get an idea of the missing connection to update the data.
  • Strange delay for starting pyside6-deploy packaged app

    Unsolved
    4
    0 Votes
    4 Posts
    466 Views
    CristianMaureiraC
    @Antonio-C compared to a normal PySide application, how long does that take? pyside6-deploy uses Nuitka under the hood. It really compiles the Python code, creating C-based python extensions, so there might be some heavy lifting to make sure all the Qt dependencies are in place. Do you see a similar approach in other compiled apps? I haven't experience this at least on Linux.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    18 Views
    No one has replied