Solved Disable the combo box specific item
-
Is there a way to disable a specific item in the combo box?
For example, there is a combo box containing items from 1 to 5. I want to limit the items that can be selected according to the permission
-
Hi,
What comes to mind:
- Use a QSortFilterProxyModel on top of a QStringListModel and filter out the values the person cannot select
- Use a custom model where you re-implement the flags
The first avoids to show "invalid values" to your user (asking why can't I select them ?).
The second should do what you original want at the risk of your users wondering why there are unelectable items in a control which should offer them only valid choices. -
Hi,
What comes to mind:
- Use a QSortFilterProxyModel on top of a QStringListModel and filter out the values the person cannot select
- Use a custom model where you re-implement the flags
The first avoids to show "invalid values" to your user (asking why can't I select them ?).
The second should do what you original want at the risk of your users wondering why there are unelectable items in a control which should offer them only valid choices.