According to the docs “If source is zero, this probe will be deactivated” But calling setSource(0) gives the following exception: Im running my code on raspberry pi 4 with Rpi Os Bullseye 64bit and PySide2 version 5.15.2. Example code: Answer The source object can be cleared like this: In C++, pas…
Tag: pyside2
Detect if all pixels in an image are zero/black (Maya Python)
Newbie. Using the following code to check if a grayscale image (a mask texture in Maya) has all black pixels in the RGB channels (meaning it is empty). This works, but is a bit slow on large images (2048×2048 is around 15 seconds). Looking for how I can speed this up / do this more efficiently. EDIT: Thi…
Qt – update view size on delegate sizeHint change
I have a QTreeView with a QStyledItemDelegate inside of it. When a certain action occurs to the delegate, its size is supposed to change. However I haven’t figured out how to get the QTreeView’s rows to resize in response to the delegate’s editor size changing. I tried QTreeView.updateGeomet…
QGraphicsItem don’t change pen of parent when chaning child
I have a multiple QGraphicsItems that are in a parent-child hierarchy. I’m trying to get highlighting of an item on mouse hover to work on an item basis, meaning that if the mouse hovers over an item it should highlight. The highlighting works fine, but if I’m performing the highlighting on a chil…
ScrollBar QStyleSheet displayed with a background when It should be transparent
I’m trying to style the scroll bar of a QtTableWidget so the part where the “scrolling part” isn’t on the bar is transparent so the scrollbar would be of the color of the background and the scrolling part (where you put your mouse) is the only part whose color is different from the bac…
PySide2 Custom Signal Error: “AttributeError: ‘function’ object has no attribute ‘connect'”
This is my third project using PySide and I came across an unusual error when trying to use custom Signals and Slots. Below is a variation of what I am working on that is giving me the AttributeError. I have used a similar syntax for other projects with no issues, so any help is appreciated. I do understand p…
Why does my QStyleItemDelegate pop up in a new window instead of in my TableView?
I’m trying to create a pretty simple app with Pyside2 that displays some data in a table that the user can edit. I want the cells of the table to autocomplete based on other values in the table, so I implemented a custom delegate following this tutorial. It was pretty straightforward and the delegate wo…
Click a button and change MainWindow
I am learning Qt and I am interesting in how to change some features of MainWindow. I was trying this code, but there were some errors when I clicked the first button: what I did wrong (how could I do ‘the_second_button_was_clicked’ callable )? main.py clickedButton.py Answer The issue has nothing…
How to Access a QT Button (from UI) in Python
I am a beginner in QT. I want to create a simple GUI to load an image from a file. That’s Why I create a button in my GUI, named pushButton (I designed the GUI by QT Creator). Now how can I access the pushButton from my python file? Here is my XML Code (from ui file) Here is My
ImportError while importing PySide2
I installed PySide2 using pip install PySide2 But i got this error when i tried to import it: Answer Have a look at the PyPI documentation here. If that doesn’t help try to use Make sure it is installede in your virtual environtment if you are using that and you are using the correct version of pip(3). …