[Interest] Qt/iOS subclassing and/or delegating

Ben Lau xbenlau at gmail.com
Wed May 27 20:24:46 CEST 2015


On 28 May 2015 at 02:07, maitai <maitai at virtual-winds.org> wrote:

> Hello all,
>
> I've started to port on iOS and need to override some methods, like we
> do easily through Java on Qt/Android. I succeeded to implement an
> appDelegate in objective-C that works for some events like openURL and
> such, but for instance I also need to lock automatic screen rotation in
> some circumstances (but not always).
>
>
Objective-C has a feature to replace the original method of a class. So you
may just override the method you needed (In case it don't break Qt)
Customizing Existing Classes
<https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html>

Example Code:
quickios/appdelegate.mm at 0b067e17dc13b8533ca3f7dd574d7e81ea17a015 ยท
benlau/quickios
<https://github.com/benlau/quickios/blob/0b067e17dc13b8533ca3f7dd574d7e81ea17a015/examples/quickiosexample/appdelegate.mm>

I have tested to override openURL and didFinishLaunchingWithOptions of
AppDelegate with Qt 5.4.1. This method works.


> I read that I should somehow override "bool
> UINavigationController::shouldRotate()"
>

Never tried. But should be worth to try? I am also be interested with your
result.


> Should I reimp (subclass?) UINavigationController and how? Or is there a
> way to create a new delegate or even better to extend my current
> appDelegate?


> I'm new to Objective-C as you can guess... Any clue would be really
> appreciated :)
>
> Thanks
> Philippe Lelong
> _______________________________________________
> 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/20150528/c78bbce5/attachment.html>


More information about the Interest mailing list