Important: Please read the Qt Code of Conduct -

iOS Status bar text and background color. How?

  • Hello all!
    Is there any way to change text and background color in Qt for iOS application? All that I found hasn't been useful. In one cases - it's depricated by Apple in other way it's not working. Have anyone experience of changing it? I am seeking solution NOT from Info.plist. I need something to change it directly from application at runtime.

  • Moderators


    set your Window flag (QML or QWidgets) to (Qt.Window | Qt.MaximizeUsingFullscreenGeometryHint) that will cover the whole space of your iPhone, and you can define the background from your app.

    You'll have to (eventually) manage the safe area manually.

  • @J-Hilk But what about text?

  • Issue closed. Solution is:

    • Setup in Info.plist this value Set the UIViewControllerBasedStatusBarAppearance to NO in the plist
    • In main.qml set the flags for Window component
    import QtQuick 2.12
    import QtQuick.Window 2.12
    Window {
        flags: Qt.Window | Qt.MaximizeUsingFullscreenGeometryHint;
        color: "red"
    • Create Objective-CPP class and inside of it use this Objective-C code (The example of creating Objective-CPP/Objective-C class published here):
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

    and for getting size of status bar use something like this:

    float ObjectiveCClass::mStatusBarHeight(void) {
    	return [[UIApplication sharedApplication] statusBarFrame].size.height;

    Be aware of the previous version of code that switching status bar text marked deprecated, something like this deprecated:

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    Official Apple guide is here
    This 3 steps will make for you something like this

    Screenshot 2020-03-23 at 18.38.57.png

Log in to reply