[Interest] QCameraViewfinder & screen orientation changed on iOS

Igor Mironchik igor.mironchik at gmail.com
Wed Sep 30 15:36:01 CEST 2015


In such solution can occur another problem. The correct solution is:

bool
CameraWindow::event( QEvent * e )
{
     switch( e->type() )
     {
         case QEvent::Resize :
         case QEvent::LayoutRequest :
         case QEvent::OrientationChange :
             QCoreApplication::processEvents();
             break;

         default :
             break;
     }

     return QWidget::event( e );
}

With this approach camera window rotates correctly and application 
doesn't crash.

9/29/2015 10:25 PM, Igor Mironchik пишет:
> Problem is still actual. I refused from QCameraViewfinder. The main 
> problem is that QCameraViewfinder eat resourses and on UI rotation 
> widget doesn't updates its layouts and so on.
>
> In my implementation of view finder before drawing frame I invoke 
> QCoreApplication::processEvents(). Without it UI doesn't update and 
> after first rotation doesn't receive any more rotation events. But 
> with processEvents() all is fine.
>
> Hope this information will be useful for somebody...
>
> On 29.09.2015 12:37, Igor Mironchik wrote:
>> Hi guys,
>>
>> Does anybody have experience with displaying QCameraViewfinder on iOS?
>>
>> I successfully display it, I see video from camera... But I have one 
>> problem: when I rotate device my window trying to rotate and stopping 
>> in the middle of this action. When I click somewhere on this screen 
>> then layout correctly updates and everything looks correct but I 
>> don't receive rotation anymore. If I don't display QCameraViewfinder 
>> then rotation works fine.
>>
>> Does anybody have experience with this problem?
>>
>> What can I do?
>>
>> How can I handle rotation events in Qt?
>>
>> I tried to connect to QScreen::orientationChanged() and do some 
>> workarounds but I don't receive this signal... I use 
>> QGuiApplication::primaryScreen()...
>>
>> Thank you.
>




More information about the Interest mailing list