Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13362

Documentation should state that widgets derived from QAbstractButton eat up mouse events when disabled

    XMLWordPrintable

Details

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            teemukat Teemu Katajisto (Inactive)
            treinio Topi Reiniƶ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes