[SailfishDevel] Detecting if running in emulator/debug mode in QML

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sat Jan 18 22:57:59 UTC 2014


Hi Antoine

Your point is valid, in the old days of the N9 Simulator I was able to  
write code to detect the simulator vs real device.

But should it be necessary?

Why should we need to detect a difference between an Emulator /  
Simulator, and a real device?

Probably because of weaknesses in the Emulator / Simulator.

In my humble opinion, it would be much better if the Emulator was so  
good that from an app developer's point of view there is no difference  
when running on an Emulator vs a real device.

I know that by it's very nature an Emulator cannot do everything a  
real device can (GPS, Sensors, Camera, LED etc. spring to mind), but  
the N9 Simulator was a good example of what is possible in this area.  
Indeed the only reason that I was forced to write code to detect the  
N9 Simulator was due to differences in font sizing.

Therefore I think Jolla's effort is best spent on providing an  
emulator that closely matches a real device, and in providing  
appropriate plugins / tools to plug the few remaining gaps (e.g a GPS  
simulating plugin).

Chris

Zitat von "Artem Marchenko" <artem.marchenko at gmail.com>:

> You can propagate C++ knowledge to QML, Antoine
>
> For example setContextProperty #ifdef QT_QML_DEBUG
>
> Best regards,
> Artem.
>
>
>
> On Sun, Jan 12, 2014 at 1:41 PM, Antoine Reversat  
> <a.reversat at gmail.com>wrote:
>
>> Hi,
>>
>> I was wondering if there is a way to know if we're in debug mode or
>> running in the emulator in QML (something like the #ifdef QT_QML_DEBUG in
>> c++). I'd like to be able to act differently whether the app is running on
>> a real device or not.
>>
>> Antoine
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>>
>
>
>
> --
> Artem Marchenko
> http://agilesoftwaredevelopment.com
> http://twitter.com/AgileArtem
>





More information about the Devel mailing list