mudlet-makers team mailing list archive
-
mudlet-makers team
-
Mailing list archive
-
Message #03864
[Bug 1400508] [NEW] (Q)Event handling code not always using accept() or ignore() to signal attitude towards invoking events
Public bug reported:
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!
** Affects: mudlet
Importance: Undecided
Status: New
--
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 the MUD client:
New
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
Follow ups
References