Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to make the item checked while i click the item in a QListWidget?
how to make the item checked while i click the item?
i want to make the item checked/unchecked while i click the item
IamSumit last edited by
Asked already ,,
i set ItemIsUserCheckable, but still can't get the effect i want.
i now setCheckState(Qt::Unchecked) to make the ListItem having a checkbox in font of the icon and text.
i just want to make the item checked/unchecked no matter where i click on the item, not i have to click the checkbox there, but i want the check state to change even when i click on the text and icon (whick mean when i select the item, i want it checked/unchecked)
That you'll have to do by hand using e.g. the itemClicked signal
thank you :)
and how to do this?
i want to make 1 item checked all the time,
i now tried a most common way: in clickedItem slot, if i checked the current item, first of it , i make all the checked items unchecked....
but i found there is no fast way to do this, eg. there is no API to get all the items or the row number
Can you described exactly what you are trying to achieve with that selection ?
actually, i want the only 1 item is selected & 1 item checked at most.
why i thought selected is not enough is that, if i use checked/unchecked, i can make them all unchecked.However, there seems no way to get all items unselected.
Only one item selected is easy to do, just enforce using SingleSelection. However that doesn't explain why the checkbook