Results 1 to 11 of 11

Thread: Color rectangles using QGraphicsRectItem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,320
    Thanks
    316
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Color rectangles using QGraphicsRectItem

    invalid use of incomplete type 'class QGraphicsSceneMouseEvent'
    Learn to understand what your compiler is telling you. This message means you have forgotten to #include the header file that defines QGraphicsSceneMouseEvent at the top of your cpp file.

    Application run properly but mouseMoveEvent handler will never be handled.
    Because by changing the signature for mouseMoveEvent() you have defined a new method for your Square class that Qt's event system knows nothing about and will never call. You should also understand that in C++, the combination of method name, return value type, and argument types define a function, not just the method name. You can't just arbitrarily replace one argument type for another. Those are different functions as far as the compiler, linker, and runtime are concerned, and the new one does not substitute for the old one. The old one still exists in Square's base class, and that's the one being called.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. The following user says thank you to d_stranz for this useful post:

    poor_fool_mloo (12th January 2018)

Similar Threads

  1. How to draw two rectangles with QtQuick?
    By TheIndependentAquarius in forum Qt Quick
    Replies: 6
    Last Post: 27th September 2013, 11:32
  2. Drawing rectangles in QT
    By andreahmed in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2012, 19:08
  3. Replies: 1
    Last Post: 9th August 2010, 19:44
  4. How to get QGraphicsRectItem filled color
    By wisconxing in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2009, 02:28
  5. editable rectangles
    By parmar ranjit in forum Qt Programming
    Replies: 3
    Last Post: 20th February 2008, 09:59

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
  •  
Qt is a trademark of The Qt Company.