问题描述
我有 pyside6 应用程序,我想将应用程序的样式设置为 Material Design 所以我在下面设置了 func tableView(_ tableView: UITableView,numberOfRowsInSection section: Int) -> Int {
if section == selectedSection{
return 10
}else{
return 0
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 5
}
:
sys.argv += ['--style','material']
但我给出了错误:
import sys,os
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine,qmlRegisterType
from PySide6.QtCore import QObject,Slot,Signal,QTimer,QUrl
import PySide6
if __name__ == "__main__":
#os.environ['QT_QUICK_CONTROLS_STYLE'] = "material"
#==================================================
sys.argv += ['--style','material']
#==================================================
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
engine.load(os.path.join(os.path.dirname(__file__),"qml/main.qml"))
if not engine.rootObjects():
sys.exit(-1)
sys.exit(app.exec_())
我最近安装了 Qt 6 并使用了 pyside6
解决方法
似乎在 Qt6 中的名称比 Qt5 中的名称限制更多,因此您应该使用“Material”而不是“material”。