Results 1 to 7 of 7

Thread: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

  1. #1
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    Hi,
    I have overriden a class from QGraphicsItem in Qt4.4.0. In that class, i have overriden the function
    contains(const QPointF& a_point) . This contains(const QPointF& a_point) function was overriden for selecting of the item. So when i move the mouse over the graphicsItem, that function should get called.

    I have seen that with Qt4.4.0, the contains(const QPointF& a_point) function is not getting called, whereas with Qt4.2.2 , the contains(const QPointF& a_point) function is getting called.

    Please let me know if anybody knows the answer .

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    make sure you have not forgotten the "const" in the function's signature

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    Thanks for replying.
    I have put the const in the function signature contains(const QPointF& a_point)
    Actually, the same piece of code I am tring to compile with Qt4.4 and Qt4.2.
    In Qt4.2 , it enters the contains function but in Qt4.4 it does not enter the contains function.

    Please let me know if anybody knows the answer.
    Thanks

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    just to make sure: I mean the 2nd const:
    Qt Code:
    1. bool contains ( const QPointF & point ) const
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    Hi,
    Thanks for replying me.
    There is only one Qt function bool contains(const QPointF& a_point) const in QGraphicsItem which i am overriding. It gets called in Qt4.2 but does not gets called in Qt4.4 when i override.
    The same pice of code i am using for both Qt4.4 and Qt4.2 .

    Please let me know if you know the answer

    Thanks

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    Maybe it doesn't need to be called?

  7. #7
    Join Date
    Oct 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Issue with contains(const QPointF& a_point) in QGraphicsItem in Qt4.4.0

    Hi,
    The problem is that it if i dont override that function, i am not able to do selection of the item.
    I have to override this function to do selection of the item because it needs to know whether the mouse is over the item or not.

    The item is our own derived item from QGraphiceItem . Its a vector of points .
    Please suggest me if there is any other function similar to contains function in Qt4.4 which I can override .

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.