QComboBox哪个更好使用?findText或findData Q

2024-09-30 18:17:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要从QcomboBox中选择一个项目。在

index = combobox.findText("D:\Squisher\squish\SQUISH_TESTS_TRUNK_2018x_TNA8\suite_DeltaGen\tst_LookAndShadow_2\testdata\ref\SurroundingsCompleted\Backplates\coast_backplate_test.tif")
if index >= 0:
    combobox.setCurrentIndex(index)

这就是我如何选择一个值。但是有时,findText返回-1,即使Combobox中存在该值。所以我想用findData代替findText。 findText和findData有什么区别?哪个更好?为什么?在


Tags: 项目indextestssuitetrunktstfindtextcombobox