Results 1 to 2 of 2

Thread: QGraphicsView: Need event emitted when line is dropped on rectangle?

  1. #1
    Join Date
    Apr 2014
    Posts
    125
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Question QGraphicsView: Need event emitted when line is dropped on rectangle?

    I'm building an editor (similar to MS Visio) to draw a hierarchical finite state machine. Hence I need to connect rectangles (states) with lines (transitions) in my drawing area.

    I will use a drag and drop approach.

    Any idea on how to have an event emitted when a line is dropped (or is connected to) on a rectangle?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView: Need event emitted when line is dropped on rectangle?

    If you mean you are moving a line item and want to check whether it currently insects with a rectangle item, see QGraphicsItem::collidesWith and QGraphicsScene::collidingItems.

    Cheers,
    _

Similar Threads

  1. How to draw a rectangle or line on an image
    By Shubham in forum Newbie
    Replies: 6
    Last Post: 18th February 2014, 08:17
  2. Dragging a rectangle across a QGraphicsView
    By blooglet in forum Qt Programming
    Replies: 2
    Last Post: 16th November 2010, 11:19
  3. Replies: 2
    Last Post: 29th April 2010, 21:44
  4. Why there are always dashed-line rectangle on QToolButton?
    By FinderCheng in forum Qt Programming
    Replies: 5
    Last Post: 25th October 2009, 00:56
  5. Cannot find line or rectangle widget
    By Kapil in forum Newbie
    Replies: 3
    Last Post: 23rd February 2006, 12:01

Tags for this Thread

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.