[Interest] iOS Objective-C callback block example connecting back to iOS Qt app?
Ben Lau
xbenlau at gmail.com
Fri May 15 09:33:53 CEST 2015
Hi Edward,
You may find example code from my project.
quickios/qisystemutils.mm at master · benlau/quickios
<https://github.com/benlau/quickios/blob/master/qisystemutils.mm>
It has implemented an interface to create and communicate to UIAlertView ,
UIActionSheet , UIImagePickerController etc. It uses a singleton object
called SystemMessenger as the bridge between C++ and Objective-C++ code. So
that the developed code can be run on non-iOS platform too (for
development use)
On 15 May 2015 at 05:53, Edward Sutton <edward.sutton at subsite.com> wrote:
> Can anyone share an example on how to implement the asynchronous return of
> a result from an Objective-C callback block to Qt?
>
> For example, see the “successBlock:” below which gets called back
> asynchronously.
>
> self.PDFCreator = [NDHTMLtoPDF createPDFWithHTML:(NSString*)html
> baseURL:(NSURL*)baseUrl
>
> pathForPDF:[@"~/Documents/hello-world.pdf" stringByExpandingTildeInPath]
> pageSize:kPaperSizeA4
> margins:UIEdgeInsetsMake(10, 5, 10, 5)
> successBlock:^(NDHTMLtoPDF *htmlToPDF) {
>
> NSString *result = [NSString stringWithFormat:@"HTMLtoPDF did
> succeed (%@ / %@)", htmlToPDF, htmlToPDF.PDFpath];
> NSLog(@"%@",result);
> self.resultLabel.text = result;
>
> }
> errorBlock:^(NDHTMLtoPDF *htmlToPDF) {
> NSString *result = [NSString stringWithFormat:@"HTMLtoPDF did
> fail (%@)", htmlToPDF];
> NSLog(@"%@",result);
> self.resultLabel.text = result;
> }];
>
>
> Background:
> ————————
>
> I need to implement native iOS code to replace the missing QPrinter
> functionality I used to convert HTML to a PDF report on Android, OS X,
> Linux, and Windows.
>
> Unfortunately the Qt html-to-pdf functionality is implemented in
> QPrinter. This functionality is gone from Qt iOS since iOS has no printer
> device support, even though I am not accessing a printer device from iOS.
>
> I found this project which seems to work:
>
> https://github.com/iclems/iOS-htmltopdf
>
> Objective-C interfacing to C++ is challenging.
>
> Thanks in advance for any tips,
>
> -Ed
> This email and any files transmitted with it from The Charles Machine
> Works, Inc. are confidential and intended solely for the use of the
> individual or entity to which they are addressed. If you have received this
> email in error please notify the sender. Our company accepts no liability
> for the contents of this email, or for the consequences of any actions
> taken on the basis of the information provided, unless that information is
> subsequently confirmed in writing. Please note that any views or opinions
> presented in this email are solely those of the author and do not
> necessarily represent those of the company. Finally, the recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150515/f740e664/attachment.html>
More information about the Interest
mailing list