Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Disabled but selectable Qlistwidgetitem
Is there any way that a particular item in qlistwidget can be shown as disabled, but can be highlighted on mouse click.
I notice that if the flag Qt::ItemIsEnabled is not set for a particular qlistwidgetitem, then it gets disabled. But when it is disabled, nothing else can be done as well meaning that it is not selectable with mouse click either.
Is there a workaround solution for this ?
What would be the usecase of having an item appear to be disabled, only to act as enabled? Sounds like you are trying to confuse your users?
What I m trying is something bit more. Following is exactly what I want..... When I click an item in the list, a popup corresponding to that particular item should appear. If the item in the list is disabled and there is a click on it, then there should be a warning message to the user saying that "y this is disabled and what measures to take so as to enable it".
This is my shot at the problem:
When I click an item in the list, i print the name of the item clicked to the screen(so that, based on this name, i can create my popup)
But when i click on a disabled item, it actually prints the previously selected item in the list(Which means, popup corresponding to the previously selected item appears and not the warning message)
Auch... that sounds horrible to use... Are you sure you need popups for that?
Wouldn't it be much more friendly to use the tooltip to inform the user of what the problem is? And pop-ups on single clicks on list items really don't sound like a good idea to me. Clicking is supposed to mean "make current; select" for such widgets. Throwing a popup in the users face is unfriendly at best.
The thing is that, on invoking each of those items, a new window should popup, which is supposed to take several inputs from the user for that particuar item ... so I cant avoid those popup window.
Thats true.... poppups for single click might be annoying to the user. How about popup window on double click ? would it be a good idea?
You mean to say tooltip(having warning information) for the disabled item? Yes... that seems nice...
Will try out all of these tomorrow and see how things look. Thanks a lot for your suggestion, Andre.
Just curious to know if there is an alternate look and feel: Now that you know my requirement, instead of using qlistwidget for doing all these, would u suggest me an alternate idea ?
Why not go for a two-pane approach: the left pane would be the list of items, the right pane would show an editor for the currently selected item. No popups needed. Also, instead of disabling items, you could considder distinguishing them in another way, such as using a different icon for them. That way, you can select them, and the right hand pane could simply show a message with explains what to do to make the item editable.
goetz last edited by
If there is only one way to make an item active, a tool tip should be sufficient. The user already see the item being different when disabled.
Using a two pane display as Andre suggested, seems much more user friendly to me.
I did try both of them ... 1) Double click & 2) Two-Pane display ...
I just felt that popups are bit unique & different than the 2-pane display in terms of its look and feel... meaning that, user can click anywhere outside the popup window to close it automatically. (not required to click on close button). These kind of UI is something which user might not see very often.
Thanks a lot for ur ideas Andre and Volker ... anyways, now that I have both of these UI, let me wait and see which one of these to use & go ahead ;)