Category : pyside

I am using PySide6 to build a desktop application and I have found myself with three different widget signals connecting to the same slot: self.ui.search_line_edit.returnPressed.connect(self.search) self.ui.search_button.clicked.connect(self.search) self.ui.search_history_table.itemDoubleClicked.connect(self.search) I could use a loop like below: search_widgets_signals = [self.ui.search_line_edit.returnPressed, self.ui.search_button.clicked, self.ui.search_history_table.itemDoubleClicked] for search_widget_signal in search_widgets_signals: search_widget_signal.connect(self.search) Is there a better way to do this ? Source: Python ..

Read more

I am experiencing a strange problem with QObject().receivers method. import sys from PySide2.QtWidgets import QApplication, QMessageBox, QWidget from PySide2.QtCore import Slot, Signal, SIGNAL if __name__ == "__main__": app = QApplication(sys.argv) widget = QWidget() signal = Signal() print(widget.receivers(signal)) sys.exit(app.exec_()) It works under PyQt5, but fails under PySide2 with the following error: TypeError: ‘PySide2.QtCore.QObject.receivers’ called with wrong ..

Read more

# -*- coding: utf-8 -*- from PySide6.QtWidgets import * from PySide6.QtCore import * from PySide6.QtGui import * from loginWindow import Ui_LoginWindow from mainWindow import Ui_MainWindow import sys class LoginWindow(QMainWindow, Ui_LoginWindow): def __init__(self, *args, obj=None, **kwargs): super(LoginWindow, self).__init__(*args, **kwargs) self.setupUi(self) self.setWindowFlags(Qt.FramelessWindowHint) self.pushButton_userLogin.clicked.connect(self.userLogin) def userLogin(self): self.hide() # mainWindow UI Load app = QApplication() window = LoginWindow() window.show() ..

Read more

I am developing an app that uses QML and PySide2. I am trying to open a file dialog when a button is pushed, but I keep getting the following exception that I dont really understand: FIXME Subscripted generics cannot be used with class and instance checks Traceback (most recent call last): File "/home/chris/Documents/Programming/Synchrony/Desktop/gui.py", line 47, ..

Read more

I’m building a small image annotation app, but encountered some issues. In short, this app allows the user to free-hand-draw aliased pixel mask on an image. For this, I create a – QGraphicsView |– QGraphicsScene # for drawing the overlaid mask |– QGraphicsPixmapItem # for the underlying image And I detect mousePressEvent, mouseMoveEvent, and mouseReleaseEvent ..

Read more