Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Detect QGraphicsScene changes
Forum Updated to NodeBB v4.3 + New Features

Detect QGraphicsScene changes

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    issam
    wrote on last edited by
    #1

    Hi,
    I am currently developing a small graphic application. It consist on a QMainWindow with a QGraphicsScene as centralwidget !
    I want to implement a function that, when the application is closed, will check if the graphicsScene modifications (add/delete/move graphics items) are saved to an XML file. I know this function:

    @changed ( const QList<QRectF> & region )@

    I don't know how to use it ! It sometimes work and sometimes don't !
    any idea ?

    http://www.iissam.com/

    1 Reply Last reply
    0
    • U Offline
      U Offline
      utcenter
      wrote on last edited by
      #2

      This is not a function, it is a signal. Add a bool sceneChanged to your main window, connect the changed() signal to a slot that sets the sceneChanged to true, and when closing the application, check if the scene has changed, and if so - serialize it to disk in a format of your choice.

      I'd personally prefer JSON over XML - it is faster to parse and more space efficient. Also easier on the eyes in case you need to modify it manually.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        issam
        wrote on last edited by
        #3

        yes it's a signal and i will use :
        @void sceneRectChanged ( const QRectF & rect )@

        instead :)

        Well another question how to use JSON with Qt ?

        http://www.iissam.com/

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved