[Interest] iOS Objective-C callback block example connecting back to iOS Qt app?

Robert Iakobashvili coroberti at gmail.com
Fri May 15 14:29:46 CEST 2015


Dear Ed,
There is an example attached to this
bug report:

https://bugreports.qt.io/browse/QTBUG-42705

The attached to the bug example code is about
mixing Qt C++ and Obj-C code and sharing text.

May be it could be helpful.

Take care.

Regards,
Robert

On Fri, May 15, 2015 at 3:26 PM, Edward Sutton <edward.sutton at subsite.com>
wrote:

>  Hi Ben,
>
>  Thank you very much for sharing your example.
>
>  https://github.com/benlau/quickios/blob/master/qisystemutils.mm
>
>  Understanding the Objective-C language has been much more difficult than
> I expected coming from C, C++, and C#.
>
>  QMessageBox looks horrible on iOS.  I am very glad you have a solution
> for using UIAlertView in your alertViewCreate method.
>
>  UiActionSheet and UIImagePickerController
>
> This has given me much to study and understand.
>
>  Thank you again for sharing your iOS code!
>
>  -Ed
>
>
>
>  On May 15, 2015, at 2:33 AM, Ben Lau <xbenlau at gmail.com> wrote:
>
>  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
>>
>
>
> 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/44f73ba4/attachment.html>


More information about the Interest mailing list