PyQt5 – Setting role to item in ComboBox
In this article we will see how we can set the item role in combo box, by default when we create a combo box and add items to it no role is set to the items, in order to set this we will use
Syntax : combo_box.setItemData(index, role)
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Argument : It takes two argument one is integer i.e index or item and other is the string i.e role of item
Action performed : It will assign role to the item
Below is the implementation –