Results 1 to 2 of 2

Thread: How can I capture click events/signals of a QGraphicsSvgItem

  1. #1

    Default How can I capture click events/signals of a QGraphicsSvgItem

    I'm new to Qt. How can I capture click events/signals of a QGraphicsSvgItem inside a QGraphicsScene? I have the following code:

    Qt Code:
    1. QGraphicsScene *scene = new QGraphicsScene(this);
    2. QGraphicsSvgItem *svgItem = new QGraphicsSvgItem(":/SomeGraphic.svg");
    3. svgItem->scale(0.1, 0.1);
    4. svgItem->setPos(-200,-200);
    5. scene->addItem(svgItem);
    To copy to clipboard, switch view to plain text mode 
    Is it possible to connect() the click() signal of svgItem to a slot?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,720
    Thanks
    259
    Thanked 760 Times in 750 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How can I capture click events/signals of a QGraphicsSvgItem

    If it had such a signal, of course you could connect a slot to it. Unfortunately, there is no such signal. There are however, various mouse events which you could override in a class derived from QSvgGraphicsItem or which you could monitor by installing an event filter on the QSvgGraphicsItem itself.

Similar Threads

  1. Replies: 2
    Last Post: 16th July 2012, 13:40
  2. How to capture mouse events while using QDirectPainter?
    By mawillia in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th September 2011, 14:40
  3. Qt Capture windows events outside the application
    By flair-kun in forum Qt Programming
    Replies: 3
    Last Post: 16th December 2009, 00:56
  4. Can Qt4 capture mousePress events on the desktop?
    By simula in forum Qt Programming
    Replies: 5
    Last Post: 6th January 2009, 20:10
  5. Capture events in a custom delegate
    By vfernandez in forum Qt Programming
    Replies: 9
    Last Post: 19th March 2008, 06:33

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.