pyqt5

Drag and drop files to QListWidget created with QT-Designer

Drag and drop files to QListWidget created with QT-Designer Question: i am trying to implement a drag and drop feature to PyQt5 QListWidget it works if self.acceptDrops(True) is in the code but it works on whole application window and wherever i drag file in the window it will add a file to QListWidget… My goal …

Total answers: 1

Add dropdown actions to Pyqt5 frame widget when right-click event is triggered

Add dropdown actions to Pyqt5 frame widget when right-click event is triggered Question: I have a Qframe widget and I already created an event triger like this def mousePressEvent(self, QMouseEvent): if QMouseEvent.button() == Qt.RightButton: # do what you want here print("Right Button Clicked") #showMenuAtMouseLocation() # to be implemented I want a small menu list to …

Total answers: 1

How to get an old_value from handleItemChanged on QTableWidget in PyQt5

How to get an old_value from handleItemChanged on QTableWidget in PyQt5 Question: I have a question related to QTableWidget and handleItemChanged. Is there a way to get the before change and after the change values for comparison? import sys from PyQt5.QtCore import * from PyQt5 import QtCore from PyQt5.QtGui import * from PyQt5.QtWidgets import * …

Total answers: 1

Is it possible to disable the highlighting effect on a selected cell in a QTableWidget?

Is it possible to disable the highlighting effect on a selected cell in a QTableWidget? Question: In this example, I have a grid with cells that can be colored and uncolored. import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * class MainWindow(QMainWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.setGeometry(100, 100, …

Total answers: 1

Change a label after a specified time

Change a label after a specified time Question: I am trying to change a label on a button click and then after 3 seconds I want it to change back to nothing ("") my code is this: def apply_click(self): ui.label_ischanged.setText("Applied!") and I connected it to my button then I used time.sleep(3) but I know that …

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

PyQT5 – how to use QWidget, QScrollArea and QBrush all together

PyQT5 – how to use QWidget, QScrollArea and QBrush all together Question: I am trying to: Display an image which is bigger than the window size; Make the window scrollable, so I can roll through the whole image; Draw over the image; Problem is: As soon as I make the window scrollable, I can’t see …

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

Search (position) in two-dimensional List

Search (position) in two-dimensional List Question: There is a list: Aliances=[(1, ‘Star Aliance’), (2, ‘OneWorld’), (3, ‘SkyTeam’), (4, ‘Unknown’), (5, ‘U-FLY Alliance’), (6, ‘SkyTeam Cargo’), (7, ‘WOW’), (8, ‘Vanilla Alliance’), (9, ‘Value Alliance’), (10, ‘American Eagle’), (11, ‘American Airlines’), (12, ‘Sirius Aero’), (10012, ‘ASL Aviation Holdings DAC’)] There is a number that is on this …

Total answers: 1

PyQt readyRead: set text from serial to multiple labels

PyQt readyRead: set text from serial to multiple labels Question: In PyQt5, I want to read my serial port after writing (requesting a value) to it. I’ve got it working using readyRead.connect(self.readingReady), but then I’m limited to outputting to only one text field. The code for requesting parameters sends a string to the serial port. …

Total answers: 2