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.alh...@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.gustav...@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.alh...@gmail.com]
>> Sendt: 16. september 2014 11:51
>> Til: Gustavsen Richard
>> Kopi: Karl Loveridge; interest@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.alh...@gmail.com> wrote:
>> On Fri, Sep 12, 2014 at 10:15 AM, Gustavsen Richard 
>> <richard.gustav...@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....@qt-project.org 
>> [interest-bounces+richard.gustavsen=digia....@qt-project.org] på vegne av 
>> Karl Loveridge [kloveri...@eatsleepplay.biz]
>> Sendt: 12. september 2014 02:10
>> Til: interest@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@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>> 
>> 
>> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to