qt

Can someone explain how QGraphicsItems interact with QGraphicsScene coordinates? (PySide6)

Can someone explain how QGraphicsItems interact with QGraphicsScene coordinates? (PySide6) Question: I am confused by Qt’s coordinate handling in a QGraphicsScene. I’m using PySide6, and create a QGraphicsScene with movable QGraphicsRectItems. I would like to limit the items to the boundaries of the scene. There is an example in the PySide docs, but it does …

Total answers: 2

qt.qpa.xcb: could not connect to display localhost:17.0 DIFFERENT set up

qt.qpa.xcb: could not connect to display localhost:17.0 DIFFERENT set up Question: I run my Python code in VSCode on Windows 10 which ssh to the remote RPi 4. Got this error: qt.qpa.xcb: could not connect to display :1 qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/pi/mambaforge/envs/mb/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found. This …

Total answers: 1

Qt for python not working: Spyder not launching and matplotlib unable to plot

Qt for python not working: Spyder not launching and matplotlib unable to plot Question: I am running Windows. I have Anaconda and several environments there, I use Spyder, and also Visual studio Code. After updating packages (many, I cannot really tell which ones), spyder cannot be launched anymore. I get a window error with the …

Total answers: 1

Why do similar signal/slot connections behave differently after Pyqt5 to PySide6 port

Why do similar signal/slot connections behave differently after Pyqt5 to PySide6 port Question: I’m porting a pyqt5 GUI to pyside6 and I’m running into an issue I don’t understand. I have two QSpinboxes that control two GUI parameters: One spinbox controls the weight of a splitter, the other controls the row height in a QtableView. …

Total answers: 2

Plot image at center of label in PyQT

Plot image at center of label in PyQT Question: QGridLayout is used to place QLabel. Then cv2 images are displayed as follows. frame = self.dequeList[cam.camID].popleft() img = QtGui.QImage(frame, frame.shape[1], frame.shape[0], QtGui.QImage.Format_RGB888).rgbSwapped() pix = QtGui.QPixmap.fromImage(img) self.videoList[f"video_{cam.camID}"].setPixmap(pix) Now display start from 0,0 coordinates as below. I like to display image at the center of label. How can …

Total answers: 1

Is there a function to save a snapshot of a qt widget in a variable?

Is there a function to save a snapshot of a qt widget in a variable? Question: I am trying to create a function to export an animated plot to a video format. This plot is a qt widget. I believe the first step in this is to transform a single image into a bytearray or …

Total answers: 1

QTreeView column header width is too large

QTreeView column header width is too large Question: I am trying to set up a simple QTreeView with nice columns. The first two columns are set to fit the contents, the last column is set to stretch. For some reason, the minimum width of the last column ("Balance") is way higher than it needs to …

Total answers: 1

Why can't I sort columns in my PyQt5 QTableWidget using UserRole data?

Why can't I sort columns in my PyQt5 QTableWidget using UserRole data? Question: I am trying to sort my QTableWidget columns by the values stored in the user role of each QTableWidgetItem, but I am unable to do so. I have enabled sorting with self.setSortingEnabled(True), and I have set the data in each QTableWidgetItem with …

Total answers: 2

QAxWidget glitches when resizing GUI window

QAxWidget glitches when resizing GUI window Question: I am currently exploring the possibilities of displaying and working with PowerPoint presentations in a GUI using PyQt5/PyQt6 and Python. For that I found the most promising solution to be using a QAxWidget. Loading and displaying the pptx-file works fine, but unfortunately I noticed glitches when resizing the …

Total answers: 1

How a QHBoxLayout could remove itself?

How a QHBoxLayout could remove itself? Question: I have a code that makes some QHBoxLayouts with some elements in them. I want to remove each Row class (QHBoxLayouts object) when clicking on their own remove button. Here is the code for testing it from sys import exit, argv from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, …

Total answers: 1