QComboBox Item Disable
General and Desktop
2
Posts
2
Posters
15.4k
Views
1
Watching
-
The proper way of doing this would be to provide a custom model for combo box and clear the ItemIsSelectable and ItemIsEnabled flags for the items you want to disable.
If you're not afraid of undocumented hacks that can break at any given point in the future there's also "this dirty dirty trick":http://theworldwideinternet.blogspot.com/2011/01/disabling-qcombobox-items.html based on current internal implementation of default model:
@
// disable item
ui->comboBox->setItemData(index, 0, Qt::UserRole - 1);
// enable item
ui->comboBox->setItemData(index, 33, Qt::UserRole - 1);
@