Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. iOS: HowTo send SIGNAL when Controller ends preview
Forum Updated to NodeBB v4.3 + New Features

iOS: HowTo send SIGNAL when Controller ends preview

Scheduled Pinned Locked Moved Solved Mobile and Embedded
sharingios
12 Posts 3 Posters 3.9k Views 2 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.
  • ekkescornerE ekkescorner

    For my Sharing Example App I have to send a SIGNAL when UIDocumentInteractionController ends preview.

    MyShare.mm:

    void MyShare::sendFile(...) {
        static DocViewController* docViewController = nil;
        ...
        docViewController = [[DocViewController alloc] init];
        [qtUIViewController addChildViewController:docViewController];
        documentInteractionController.delegate = docViewController;
        [documentInteractionController presentPreviewAnimated:YES];
        ...
    }
    // TODO: HowTo call this method from docViewController ?
    void MyShare::handleDocumentPreviewDone() {
    	// send the SIGNAL
    	emit shareFinished();
    }
    

    DocViewController.mm:

    #import "DocViewController.h"
    @interface DocViewController ()
    @end
    @implementation DocViewController
    #pragma mark -
    #pragma mark View Life Cycle
    - (void)viewDidLoad {
        [super viewDidLoad];
    }
    #pragma mark -
    #pragma mark Document Interaction Controller Delegate Methods
    - (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
        #pragma unused (controller)
        return self;
    }
    - (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
    {
        #pragma unused (controller)
        // TODO HowTo call handleDocumentPreviewDone() from MyShare ??
        [self removeFromParentViewController];
    }
    @end
    

    I have no Obj-C knowledge, it's even hard to 'read' the syntax - that's why I'm not developing native for iOS and using Qt ;-)
    any ideas what to do ?
    it's the very last step before I'll make my Sharing Example App for Android and iOS public.
    thx

    ekkescornerE Offline
    ekkescornerE Offline
    ekkescorner
    Qt Champions 2016
    wrote on last edited by
    #2

    is there anybody out there ...
    ... with some Obj-C knowledge ?

    thx

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.8 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    tekojoT 1 Reply Last reply
    0
    • ekkescornerE ekkescorner

      is there anybody out there ...
      ... with some Obj-C knowledge ?

      thx

      tekojoT Offline
      tekojoT Offline
      tekojo
      wrote on last edited by
      #3

      @ekkescorner did you ask on QtMob yet? (https://qtmob.slack.com/ for those who don't know the place)

      ekkescornerE 1 Reply Last reply
      0
      • tekojoT tekojo

        @ekkescorner did you ask on QtMob yet? (https://qtmob.slack.com/ for those who don't know the place)

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by
        #4

        @tekojo yes, I already asked there some days ago.
        will try Interests list and StackOverFlow

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.8 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi,

          Add a custom init function to DocViewController which takes a MyShare object as parameter (e.g. initWithMyShare) then pass it the instance of your object and store it as a local variable. Then just call the method on the object in documentInteractionControllerDidEndPreview.

          You can see an implementation example for the iOS clipboard support class.

          Hope it helps

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          ekkescornerE 2 Replies Last reply
          2
          • SGaistS SGaist

            Hi,

            Add a custom init function to DocViewController which takes a MyShare object as parameter (e.g. initWithMyShare) then pass it the instance of your object and store it as a local variable. Then just call the method on the object in documentInteractionControllerDidEndPreview.

            You can see an implementation example for the iOS clipboard support class.

            Hope it helps

            ekkescornerE Offline
            ekkescornerE Offline
            ekkescorner
            Qt Champions 2016
            wrote on last edited by
            #6

            @SGaist thx. will try to figure out the correct syntax ;-)

            ekke ... Qt Champion 2016 | 2024 ... mobile business apps
            5.15 --> 6.8 https://t1p.de/ekkeChecklist
            QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Add a custom init function to DocViewController which takes a MyShare object as parameter (e.g. initWithMyShare) then pass it the instance of your object and store it as a local variable. Then just call the method on the object in documentInteractionControllerDidEndPreview.

              You can see an implementation example for the iOS clipboard support class.

              Hope it helps

              ekkescornerE Offline
              ekkescornerE Offline
              ekkescorner
              Qt Champions 2016
              wrote on last edited by
              #7

              @SGaist thx to your hints I found a way to make it work.
              I'm writing a blog about the App and perhaps someone can take a look at the code if it's ok.

              ekke ... Qt Champion 2016 | 2024 ... mobile business apps
              5.15 --> 6.8 https://t1p.de/ekkeChecklist
              QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                I'd be happy to review it.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                ekkescornerE 1 Reply Last reply
                0
                • SGaistS SGaist

                  I'd be happy to review it.

                  ekkescornerE Offline
                  ekkescornerE Offline
                  ekkescorner
                  Qt Champions 2016
                  wrote on last edited by
                  #9

                  @SGaist cool. will let you know when it's public. probably tomorrow.
                  this was the last open topic on iOS.
                  I must know when preview was done, because if sharing a File from App Data Location, the File must be copied to Documents Location to be available for UIDocumentInteractionController. Then when user comes back to the App I must delete the File from Documents location.

                  ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                  5.15 --> 6.8 https://t1p.de/ekkeChecklist
                  QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Might be a job for QTemporaryFile ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    ekkescornerE 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Might be a job for QTemporaryFile ?

                      ekkescornerE Offline
                      ekkescornerE Offline
                      ekkescorner
                      Qt Champions 2016
                      wrote on last edited by
                      #11

                      @SGaist I need the origin filename, so I don't think so.
                      BTW: on iOS I must always delete the file from Documents location,
                      on Android if ACTION_VIEW intent I also delete the file,
                      but if ACTION_EDIT then depending from result code I must move File back into origin AppDataLocation or simply delete if Edit was canceled.

                      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                      5.15 --> 6.8 https://t1p.de/ekkeChecklist
                      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                      1 Reply Last reply
                      0
                      • ekkescornerE Offline
                        ekkescornerE Offline
                        ekkescorner
                        Qt Champions 2016
                        wrote on last edited by
                        #12

                        here's the Blog: http://blog.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app/
                        thx to all helping me with this

                        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                        5.15 --> 6.8 https://t1p.de/ekkeChecklist
                        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                        1 Reply Last reply
                        1

                        • Login

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