[Interest] Future of Qt with Ios
Kate Alhola
kate.alhola at gmail.com
Thu Sep 18 12:54:13 CEST 2014
I got screen rotation to work with ios8. It needes patch to qioswindow.mm: - (void)layoutSubviews . At the moment the patch is very dirty, contains redundant and debugging code but it works. So lot of cleanupmis needed.
As summary, there was three issues to get ios8 to work
1- must use qt5.3.2, earliers dot work, they crash
2- path for application storing files is changed an need to be fetched with NSFileManager
3- screen rotation does not work, this needs patch to qioswindow.mm: - (void)layoutSubviews
With all fixes same app binary should run in both ios7 and ios8
Kate
Lähetetty iPadista
> Kate Alhola <kate.alhola at gmail.com> kirjoitti 17.9.2014 kello 18.56:
>
> Thank you about this hint. It looks that this is not all. Orientation change is handled in
> qioswindow.mm: - (void)layoutSubviews . This method is called normally with ios7 and
> actualGeometry changes when orientation changes. In IOS8 this does no longer work.
>
> This function is now called 6 times during one phone orientation change.
> I can get orientation from root window dimensions but that's not yet all.
> setting size does not produce results i wanted.
>
> Kate
>
>> On Tue, Sep 16, 2014 at 6:55 PM, Brian Dentino <brian.dentino at gmail.com> wrote:
>> There are a number of ways you could implement a workaround for this; here's one. Modify the QIOSScreen::updateProperties() function as follows. Basically, landscape/portrait detection seems to work fine, but the UIScreen bounds width/height get flipped between iOS7 and iOS8. This just checks if the orientation is landscape or portrait and sets the geometry appropriately based on which is larger, height or width.
>>
>> void QIOSScreen::updateProperties()
>> {
>> bool inPortrait = UIInterfaceOrientationIsPortrait(m_uiWindow.rootViewController.interfaceOrientation);
>>
>> qreal width = inPortrait
>> ? qMin(m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width)
>> : qMax(m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width);
>> qreal height = inPortrait
>> ? qMax(m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width)
>> : qMin(m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width);
>> QRect geometry = inPortrait
>> ? fromCGRect(m_uiScreen.bounds).toRect()
>> : QRect(m_uiScreen.bounds.origin.x, m_uiScreen.bounds.origin.y,
>> width, height);
>>
>> if (geometry != m_geometry) {
>> m_geometry = geometry;
>>
>> const qreal millimetersPerInch = 25.4;
>> m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch;
>>
>> QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry);
>> }
>>
>> QRect availableGeometry = geometry;
>>
>> CGSize applicationFrameSize = m_uiScreen.applicationFrame.size;
>> int statusBarHeight = geometry.height() - (inPortrait ? applicationFrameSize.height : applicationFrameSize.width);
>>
>> //TODO: Need to handle whether or not statusbar is hidden/overlapped on iOS 7+
>> availableGeometry.adjust(0, statusBarHeight, 0, 0);
>>
>> if (availableGeometry != m_availableGeometry) {
>> m_availableGeometry = availableGeometry;
>> QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry);
>> }
>>
>> if (screen())
>> layoutWindows();
>> }
>>
>> If you don't want to do the runtime checks, you can probably just add an ifdef block to check the iOS version and use the width/height appropriately.
>>
>> If you don't want to/can't modify the Qt source, I'm pretty sure you could achieve the effect by simply registering for the proper orientation updates in your application (using orientationUpdateMask) then setting the width/height of your root window in a similar way from within your handler slot.
>>
>> If anyone knows of a better way to do this, I'm all ears :)
>>
>> Brian
>>
>>> On Sep 16, 2014, at 4:38 AM, Kate Alhola <kate.alhola at gmail.com> wrote:
>>>
>>> Is there some part that i could backport to 5.3.2 ? Because IOS8 is out, Apple requires apps run on that, so this bug in practice prevents anyone submitting app to appstore.
>>>
>>> Kate
>>>
>>> Lähetetty iPadista
>>>
>>>> Gustavsen Richard <Richard.Gustavsen at digia.com> kirjoitti 16.9.2014 kello 13.47:
>>>>
>>>> The orientation bug is a known issue, and will be fixed with Qt-5.4.
>>>>
>>>> -Richard
>>>>
>>>> Fra: Kate Alhola [kate.alhola at gmail.com]
>>>> Sendt: 16. september 2014 11:51
>>>> Til: Gustavsen Richard
>>>> Kopi: Karl Loveridge; interest at qt-project.org
>>>> Emne: Re: [Interest] Future of Qt with Ios
>>>>
>>>> My work getting app working with ios8 continues, alone (alone, no one is interested to share experiences).
>>>>
>>>> After i got basic stuff working with Qt5.3.2RC and using NSFileManager method to get right path to data files i found next issue. Screen rotation does not work any more, or it rotates but does not notify app that it is rotated. So if I have portrait and i turn device to landscape, i have upper part of portrait visible in left side of landscape screen with right orientation but width is still portrait width. I put qDebug to eventFilter and I see that absolutely no event arrives when i turn screen.
>>>>
>>>> Kate
>>>>
>>>>> On Sun, Sep 14, 2014 at 8:13 PM, Kate Alhola <kate.alhola at gmail.com> wrote:
>>>>>> On Fri, Sep 12, 2014 at 10:15 AM, Gustavsen Richard <Richard.Gustavsen at digia.com> wrote:
>>>>>> We always work to support the latest versions of an OS, also on iOS. So yes, Qt will build and and run on iOS 8. Internally we have been working with the developer preview for some time already. We have no plans for Metal yet, though.
>>>>>
>>>>>
>>>>> I tried to look and ask what does this mean in practice. I tried with some qt supplied demo apps, Latest released Qt 5.3.1 does NOT run in IOS8, Qt5.3.2RC does run. When I tried to get my app running, i noticed that app data directories are now in new location and I needed to use [NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory to get my app working.
>>>>>
>>>>> Kate
>>>>>
>>>>>
>>>>>>
>>>>>> -Richard
>>>>>>
>>>>>> Fra: interest-bounces+richard.gustavsen=digia.com at qt-project.org [interest-bounces+richard.gustavsen=digia.com at qt-project.org] på vegne av Karl Loveridge [KLoveridge at eatsleepplay.biz]
>>>>>> Sendt: 12. september 2014 02:10
>>>>>> Til: interest at qt-project.org
>>>>>> Emne: [Interest] Future of Qt with Ios
>>>>>>
>>>>>> I’m really rooting for Qt. I love it so far. I’ve invested about 7 months into a project using Qt. But I’m having some doubts that I wonder if anyone could help me with.
>>>>>>
>>>>>> I’m concerned that Qt and the iOS are a bit at odds with each other. For instance, Apple just announced iOS 8. Try to find information about how Qt is going to handle the new OS change. I can’t find anything. Is Qt planning on supporting Metal (which is Apple’s new OpenGL replacement—which is 10x faster than OpenGL)—which is exclusively Apple. Just questions like these bother me that there isn’t “buzz” happening around Qt.
>>>>>>
>>>>>> Does anyone have any thoughts on this?
>>>>>>
>>>>>> With my project, I’m at a bit of a cross roads. Its written with Qt at its heart. The hope was to have a nice environment to make a Apple/Android app. But I’m feeling a little hesitant about the direction I’m going in.
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Interest mailing list
>>>>>> Interest at qt-project.org
>>>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>> _______________________________________________
>>> 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/20140918/1a12b2af/attachment.html>
More information about the Interest
mailing list