zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.61k stars 541 forks source link

[Bug]: PySide6-Fluent-Widgets ComboBox currentTextChanged信号值异常 #584

Closed abyss-zues closed 1 year ago

abyss-zues commented 1 year ago

What happened?

ComboBox currentTextChanged信号参数为空字符串,currentIndexChanged信号参数为-1。经排查原因大致为: image 此处无法找到对应字符串,原因时因为text参数是原字符串签名加空格。也就是由下述代码导致: image 请问,此处是BUG还是我使用不当?

Operation System

Windows 10 21H1

Python Version

Python 3.11.6 x64

PyQt/PySide Version

Pyside6.4.2

PyQt/PySide-Fluent-Widgets Version

v1.3.3

How to Reproduce?

运行最小代码,更改ComboBox项

Minimum code

# coding:utf-8
import sys

from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout

from qfluentwidgets import ComboBox, FluentIcon

class Demo(QWidget):

    def __init__(self):
        super().__init__()
        self.comboBox = ComboBox(self)
        self.hBoxLayout = QHBoxLayout(self)

        for i in ['12', '34', '56']:
            self.comboBox.addItem(i, FluentIcon.DOCUMENT)
        self.comboBox.currentTextChanged.connect(self.on_comboBox_currentTextChanged)

        self.resize(500, 500)
        self.hBoxLayout.addWidget(self.comboBox, 0, Qt.AlignCenter)
        self.setStyleSheet('Demo{background:white}')

    def on_comboBox_currentTextChanged(self, text: str) -> None:
        print(text)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = Demo()
    w.show()
    app.exec()
zhiyiYo commented 1 year ago

感谢反馈,已修复此问题