Skip to content
0
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
Collapse
SAMSON Forum
  1. Home
  2. Develop
  3. Apps
  4. Receiving signal when creating new Document

Receiving signal when creating new Document

Scheduled Pinned Locked Moved Apps
4 Posts 3 Posters 4.0k 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.
  • E
    E
    Elisa
    wrote on last edited by Elisa
    #1

    Dear all,

    I'm trying to catch the signal when a new document is created. On my app constructor, I connect to the following slots:

    SAMSON::getActiveLayer()->connectDocumentSignalToSlot(this, SB_SLOT(&MyApp::onDocumentEvent));
      SAMSON::getActiveDocument()->connectDocumentSignalToSlot(this, SB_SLOT(&MyApp::onDocumentEvent));
    

    This way I can catch for example when a new layer is created, or when my document is closed. But this code remains oblivious to the creation of a new document, and thus whenever one is created I am unable to update my signal connections and events coming from the new document are not fetched by my app.

    I'm trying to use this to do some operations in my app when loading a custom model thorugh a .sam file (I implemented serialization and unserialization).

    Thank you for your help and best regards,

    Elisa

    1 Reply Last reply
    0
    • DmitriyMarinD
      DmitriyMarinD
      DmitriyMarin
      wrote on last edited by
      #2

      Dear @Elisa

      Here you connect signal to slots for pointers of a current active layer and a current active document. There is no possibility now to listen to an event of the creation of a new document.

      Do I understand correctly that you want for your App to do some operations automatically once a .sam file was imported?

      What you can do is to create a timer in your App and connect to it a function in which you will be doing something like this:

      if(SAMSON::getActiveDocument()->documentSignalIsConnectedToSlot(this, SB_SLOT(&MyApp::onDocumentEvent)) == false) {
      
          SAMSON::getActiveDocument()->connectDocumentSignalToSlot(this, SB_SLOT(&MyApp::onDocumentEvent));
      
      }
      

      Dmitriy,
      The SAMSON Team, https://s-c.io

      1 Reply Last reply
      1
      • StephaneS
        StephaneS
        Stephane
        wrote on last edited by
        #3

        Dear @Elisa, we will expose these signals in 0.8.0.

        1 Reply Last reply
        0
        • E
          E
          Elisa
          wrote on last edited by
          #4

          Thank you both, I will use the timer as a workaround for now.

          Seems 0.8.0 is going to have a lot of interesting changes :)

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Login or register to search.
          • First post
            Last post