Results 1 to 4 of 4

Thread: Move Rectangle

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2015
    Posts
    66
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    10
    Thanked 17 Times in 17 Posts

    Default Re: Move Rectangle

    • You have hidden your Game widget.
    • Your graphicsView does not have a parent, so it is the top level widget.
    • You are implementing mouseMoveEvent on the Game widget (which is hidden!) so of course you won't receive the event.



    First thing:
    • Replace w.setVisible(false) from your main function with w.show()
    • Make graphics view the child of Game widget. i.e. replace view = new QGraphicsView; with view = new QGraphicsView(this); If you do this you don't need to show the view manually as you are currently doing.



    Once the parent child hierarchy is fixed, you should start getting the mouse events and you can move your rectangle!

    Regards
    Vikram

  2. #2
    Join Date
    Jan 2016
    Location
    Oberhausen, Germany
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android
    Thanks
    3

    Default Re: Move Rectangle

    Hi,
    Thanks for the quick replies,
    I'll take care about this.

    I'll report me later.

    Best regards
    Basti1990

Similar Threads

  1. use of Rectangle javascript
    By ravandi in forum Qt Quick
    Replies: 15
    Last Post: 23rd February 2016, 08:46
  2. Replies: 2
    Last Post: 25th December 2014, 15:15
  3. Problem in Move Move Event Handler.
    By redgoof in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 11:45
  4. Getting the bounding rectangle
    By ioannis in forum Qt Programming
    Replies: 1
    Last Post: 22nd May 2009, 00:41
  5. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34

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.