0%

QT知识

本文档用于QT学习

QT creator 4.9.1
QT 5.12.4
qt-opensource-windows-x86-5.9.9.exe

pyside

解决PySide2的This application failed to start because no Qt platform plugin could be initialized问题

1
2
3
dirname = os.path.dirname(PySide6.__file__)
plugin_path = os.path.join(dirname,'plugins','platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']= plugin_path
pyside加载Qt Creator

https://blog.csdn.net/baidu_36499789/article/details/119486355
Qt creator Qt->Qt Designer Form

1
2
pyuic5 dialogtest.ui –o test.py  # pyqt库   从ui文件生成python文件
pyside6-uic mainWin.ui > ui_.py # pyside库
1
2
3
4
5
6
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_Form()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

QT多线程
https://www.pythonguis.com/tutorials/multithreading-pyside-applications-qthreadpool/

1
2
3
Label.setScaledContents(True)                 # 加载的图片设置自适应Labbel大小
self.layout.setAlignment(QtCore.Qt.AlignLeft) # 设置对齐方式 后面可以设置控件的距离
self.layout.setAlignment(QtCore.Qt.AlignTop)

提示音乐

提示音下载网站

坚持原创技术分享,您的支持将鼓励我继续创作!