콘솔워크

pyqt5 -> pyside6로 변경할 시 주의할 점 본문

프로그래밍/python

pyqt5 -> pyside6로 변경할 시 주의할 점

이휘재123 2023. 5. 18. 17:26
반응형

기본적으로 변경할 때, PyQt5로 되어있는 import만 PySide6로 변경하면 바로 사용이 가능하지만, 몇가지 손을 봐야하는 경우가 있음.

 

# PyQt5
cp = QDesktopWidget().availableGeometry().center()

# Pyside6
cp = QGuiApplication.primaryScreen().availableGeometry().center()
# PyQt5
@pyqtSlot()

# Pyside6
@Slot()
# PyQt5
pyqtSignal()

# Pyside6
Signal()

 

 

시그널 및 슬롯의 구문을 그대로 사용하는 것은 가능하지만, import 해야하는 구문이 달라지기 때문에 그에 맞게 변환해주어야 작동한다.

# PyQt5
from PyQt5.QtCore import pyqtSignal

# Pyside6
from PySide6.QtCore import Signal

 

 

 

# PyQt5
tablewidget.horizontalHeader().setSectionResizeMode(1)

# Pyside6
tablewidget.horizontalHeader().setSectionResizeMode(1, QHeaderView.ResizeMode.ResizeToContents)
 
반응형