Results 1 to 5 of 5

Thread: how to you send signals to a graphics item?

  1. #1
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default how to you send signals to a graphics item?

    Hi so what I'm trying to do is when I click a button I want a graphics item to transition in from the side.

    How can I send a signal to the graphics item to come in when I click this button?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to you send signals to a graphics item?

    You dont need to send signal to the graphics item in this case.
    Just on button click, start changing the geometry of the item from some controller class. In the item you will need to provide functions for changing geometry/shape etc.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how to you send signals to a graphics item?

    just make QObject a parent of your item and then you can use it like any other widget in the connect method.

  4. #4
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: how to you send signals to a graphics item?

    oh wow I didn't think that was possible, I just took a 6 day training course and the instructor told us if you use graphic items you can't ever use signals/slots on them, you have to use events.

    Can you give a short code snippet on how you would force the parent to be QObject?

    Thanks!

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how to you send signals to a graphics item?

    ...what I meant was, the you item has to inherit from QObject:
    Qt Code:
    1. class MyItem : public QGraphicsItem, public QObject
    2. {
    3. Q_OBJECT
    4. //...
    5. }
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to Lykurg for this useful post:

    technoViking (6th November 2009)

Similar Threads

  1. Graphics item position after drag
    By Miihkali in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2009, 10:01
  2. send OS signals to apps on all platforms
    By Morea in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 22:00
  3. Replies: 2
    Last Post: 1st August 2008, 16:58
  4. Graphics View - Scene & Item hierarchy
    By mooreaa in forum Qt Programming
    Replies: 0
    Last Post: 29th June 2008, 23:49
  5. Reimplementing The MousePressEvent for Graphics Item
    By ashishrai in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2008, 20:11

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.