← Back to team overview

mudlet-makers team mailing list archive

[Bug 1400508] Re: (Q)Event handling code not always using accept() or ignore() to signal attitude towards invoking events

 

Migrating issues to Github, please follow the new discussion here:
https://github.com/Mudlet/Mudlet/issues/774

This issue needs to be closed and there is no appropriate status, so
will set it to "Opinion" just for migration purposes.

** Bug watch added: github.com/Mudlet/Mudlet/issues #774
   https://github.com/Mudlet/Mudlet/issues/774

** Changed in: mudlet
       Status: New => Opinion

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1400508

Title:
  (Q)Event handling code not always using accept() or ignore() to signal
  attitude towards invoking events

Status in Mudlet:
  Opinion

Bug description:
  The Qt documentation for QEvent (and subclasses) suggests that methods
  that handle such events should call accept() or ignore() on the
  (QEvent *) passed by the invoker {to set or reset the isAccepted flag}
  to indicate whether: EITHER the method "accepts" the event i.e. does
  "Handle" it and thus the event does NOT need to be passed further up
  the Widget chain in order for an ancestor to deal with it OR "ignores"
  it so that it disclaims responsibility for handling the event and does
  pass it on up to the parent.  It also notes that: "By default,
  isAccepted() is set to true, but don't rely on this as subclasses may
  choose to clear it in their constructor." unfortunately the
  documentation for individual sub classes do not seem to include this
  information, though I guess for some it can be inferred from the
  nature of their actions.

  A superficial search suggests the following may need these sort of things:
  void T2DMap::mouseDoubleClickEvent ( QMouseEvent * )
  void T2DMap::mouseReleaseEvent( QMouseEvent * )
  bool T2DMap::event( QEvent * )
  void T2DMap::mousePressEvent( QMouseEvent * )
  void T2DMap::mouseMoveEvent( QMouseEvent * )
  bool TCommandLine::event( QEvent * ) <- some code branches already have accept() others may need to have ignored() added.
  void TCommandLine::focusInEvent( QFocusEvent * )
  void TCommandLine::focusOutEvent( QFocusEvent * )
  void TCommandLine::mousePressEvent( QMouseEvent * ) <- I suspect that if ignore() was used it would not need to raise a QPlainTextEdit::mousePressEvent( QMouseEvent * ) as the last line to deal with unhandled events.
  void TConsole::resizeEvent( QResizeEvent * ) <- I suspect this automatically clears the accept flag so the event gets propagated upwards, else the QWidget::resizeEvent( QResizeEvent * ) it includes produces a similar effect.
  void TConsole::showEvent( QShowEvent * )
  void TConsole::hideEvent( QShowEvent * )
  void TLabel::mousePressEvent( QMouseEvent * )
  void TLabel::leaveEvent( QEvent * )
  void TLabel::enterEvent( QEvent * ) <- all three are like TCommandLine::mousePressEvent()

  ... etc, etc.  Blimey, there are more to check than I at first
  thought!

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1400508/+subscriptions


References