[BUG] arguments passed to setSizePolicy are not in the expected format
chiboreache opened this issue · comments
Describe the bug
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/guiscrcpy/ui/pyside2/main.py", line 31, in setupUi
MainWindow.setSizePolicy(sizePolicy)
TypeError: arguments did not match any overloaded call:
setSizePolicy(self, a0: QSizePolicy): argument 1 has unexpected type 'PySide2.QtWidgets.QSizePolicy'
setSizePolicy(self, hor: QSizePolicy.Policy, ver: QSizePolicy.Policy): argument 1 has unexpected type 'PySide2.QtWidgets.QSizePolicy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/guiscrcpy/cli.py", line 157, in cli
bootstrap(
File "/usr/lib/python3.11/site-packages/guiscrcpy/launcher.py", line 1287, in bootstrap
guiscrcpy = InterfaceGuiscrcpy(
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/guiscrcpy/launcher.py", line 111, in __init__
self.setupUi(self)
File "/usr/lib/python3.11/site-packages/guiscrcpy/ui/pyside2/main.py", line 33, in setupUi
MainWindow.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
TypeError: arguments did not match any overloaded call:
setSizePolicy(self, a0: QSizePolicy): argument 1 has unexpected type 'PySide2.QtWidgets.QSizePolicy.Policy'
setSizePolicy(self, hor: QSizePolicy.Policy, ver: QSizePolicy.Policy): argument 1 has unexpected type 'PySid
To Reproduce
Steps to reproduce the behavior:
- open program
Desktop (please complete the following information):
OS: Arch Linux
Kernel: x86_64 Linux 6.6.1-arch1-1
Packages: 2123
Shell: fish 3.6.1
Resolution: 3440x1440
DE: KDE 5.112.0 / Plasma 5.27.9
WM: KWin
GTK Theme: Sweet-Dark [GTK2/3]
Icon Theme: Uos-fulldistro-icons
Disk: 638G / 817G (83%)
CPU: AMD Ryzen 9 5950X 16-Core @ 32x 3.4GHz
GPU: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] (rev c1)
RAM: 16194MiB / 32004MiB
Additional context
The error you're encountering seems to be related to a mismatch in the arguments passed to the setSizePolicy function in a PySide2 application. The error message indicates that the function is expecting different argument types than what is being passed.
It seems like you're trying to set the size policy for a MainWindow, but the arguments passed to setSizePolicy are not in the expected format. The setSizePolicy function can take different argument types based on its overloads.
Here's an example of how you might set the size policy for a MainWindow in PySide2:
Copy code
from PySide2.QtWidgets import QMainWindow, QApplication, QSizePolicy
class MyMainWindow(QMainWindow):
def __init__(self):
super().__init__()
# Create a size policy
sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
# Set the size policy for the main window
self.setSizePolicy(sizePolicy)
if __name__ == "__main__":
app = QApplication([])
mainWindow = MyMainWindow()
mainWindow.show()
app.exec_()
In your specific case, it appears that the code is trying to set the size policy within the setupUi method of the MainWindow. Ensure that you are passing the correct argument types when setting the size policy within this method.
Check the version compatibility of your code with the PySide2 library and make sure it's in line with the expected argument types for the setSizePolicy function. Upgrading or downgrading PySide2 might resolve compatibility issues if the error persists.
This happens when both PyQt5 and PySide2 dependencies are installed. Remove one of them (it can be done directly via pip) and the application should work.