get mousepress when widget is disabled (QLineEdit)
I have some disabled controls that I want to emit a signal when they are clicked. The typical use is a QLineEdit which in some modes can be edited, and in others not. Clicking on it when disabled gives the use a prompt which allows them to enable the editing.
How can I get a mouse press event when the control is disabled?
Alternately, how can I make it just look disabled (not just read-only)?
Re: get mousepress when widget is disabled (QLineEdit)
Quote:
Originally Posted by
mortoray
How can I get a mouse press event when the control is disabled?
Reimplement event() for the widget and handle the mouse event there.
Quote:
Alternately, how can I make it just look disabled (not just read-only)?
Reimplement the paint event for the widget and change the style options passed to the style for drawing the widget.
A side note - from usability and user-friendliness perspective what you are trying to do is a very poor design. A much better approach would be to provide a checkbox near the line edit to enable or disable the widget.
Re: get mousepress when widget is disabled (QLineEdit)
Quote:
Originally Posted by
wysota
Reimplement event() for the widget and handle the mouse event there.
That works. Thank you.
Quote:
A side note - from usability and user-friendliness perspective what you are trying to do is a very poor design. A much better approach would be to provide a checkbox near the line edit to enable or disable the widget.
Agreed. In fact a single checkbox for the whole interface is all that is needed "[x] Advanced Controls". But alas, my powers of persuasion have failed me. :(
Re: get mousepress when widget is disabled (QLineEdit)
Hi, can you post the code part which u used for the reimplementing the event() function?
I'm having the same problem.