Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.0
Description
According to documentation for QWidget::enabled:
bg. An enabled widget handles keyboard and mouse events; a disabled widget does not.
This behavior is changed for widgets (buttons) derived from QAbstractButton, which reimplements event() to eat up mouse events if the widget is disabled. A comment from qabstractbutton.cpp:
// as opposed to other widgets, disabled buttons accept mouse
// events. This avoids surprising click-through scenarios
Also events of type QEvent::ContextMenu are consumed, which means that a context menu cannot be activated when right-clicking on a disabled button. Is this intentional? This can be worked around by subclassing QPushButton/QToolButton and reimplementing event(). But, this difference in behavior is not mentioned anywhere in the documentation for QAbstractButton or derived classes.