[clazy] [Bug 386134] New: Add qgraphicsitem_cast check.
Roman
bugzilla_noreply at kde.org
Tue Oct 24 09:32:47 BST 2017
https://bugs.kde.org/show_bug.cgi?id=386134
Bug ID: 386134
Summary: Add qgraphicsitem_cast check.
Product: clazy
Version: unspecified
Platform: Other
OS: All
Status: UNCONFIRMED
Severity: wishlist
Priority: NOR
Component: general
Assignee: unassigned-bugs at kde.org
Reporter: dismine at gmail.com
CC: smartins at kde.org
Target Milestone: ---
Hi, i want to propose new check. Recently i worked with QGraphicsItem and
wanted to cast a pointer. Because i use Qt i prefer to use it's cast functions,
for example qobject_cast. But somehow qgraphicsitem_cast did not work as i
expected it should be for "_cast" function. My first guess was to reimplement
the type() function as mentioned in documentation. But this did not help me
too. Then after some time i figured out that qgraphicsitem_cast can only cast
from QGraphicsItem pointer to real object type, you can't get nothing on
"middle" of hierarchy with it. And i was trying to get item's parent. My
mistake.
To sum up thoughts i propose check if the type() reimplemented for item used
with qgraphicsitem_cast. Without it it will not work. And also check if
developer doesn't try to cast on "middle". This will also doesn't work.
Yes, this is stupid mistake i did, but for someone such a check can potentially
save several hours. Hope you will like my idea.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Unassigned-bugs
mailing list