diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-04-25 22:06:14 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-26 08:24:28 -0700 |
commit | 78f4d7b2b921f4c1f1f313c5d3b1ed393144a9da (patch) | |
tree | b161c34bc1a05e7dfdb04643a8fef3d41703f91f /desktop-widgets | |
parent | e9dd1b150f3958ae90900456b04ce0688c93d7fe (diff) | |
download | subsurface-78f4d7b2b921f4c1f1f313c5d3b1ed393144a9da.tar.gz |
profile: simplify checking for DiveTextItem
When creating the context menu on the profile, the code has
to check whether the context menu is activated on the
dive computer name to show a special menu (delete / split
dive computer).
This was done by setting a special property on the item
and then checking for that property on the item that
the menu is invoked on or its parents.
The reason the code didn't simply check the pointer was
probably that DiveTextItem uses multiple inheritance:
It derives from QObject and QGraphicsItem. It has to derive
from QObject first, because (the ridiculously broken) MOC
needs it that way. The object added to the scene is a
QGraphicsItem. Thus, we get a pointer _into_ the DiveTextItem
object.
However, that's all completely unnecessary. We can simply
compare the pointers, as the compiler will understand that
QGraphicsItem is only the second base class of DiveTextItem.
Magic!
Let's remove the cruft and simply compare the pointers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
0 files changed, 0 insertions, 0 deletions