您的位置:首页 > 产品设计 > UI/UE

Qt for iOS:设置状态栏颜色(Quick)

2015-10-20 20:18 771 查看
和群友



一起研究出来的方法。

直接上代码:

main.qml

import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Window 2.0

Window {
title: qsTr("Hello World")
width: Screen.width
height: Screen.height
visible: true
color: "#ff00ff"

Rectangle {
y: Screen.height - Screen.desktopAvailableHeight
width: Screen.desktopAvailableWidth
height: Screen.desktopAvailableHeight
color: "#a1a1a1"
}
}


效果图:



需要注意的是:一定要用Window做主窗口,而且导入的一定要是2.0版本的,不能是2.1或者是2.2(至少我测试的时候是这样)

~~~~~更新ApplicationWindow的方法~~~~~

上次写的只能用在Window上,而且要2.0版本,有点坑。

今天研究了下,发现ApplicationWindow也是可以的,代码差不多。

效果一样。截图就不单独贴了。

import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Window 2.0

ApplicationWindow {
title: qsTr("Hello World")
width: Screen.width
height: Screen.height
visible: true
color: "#ff00ff"
modality: Qt.NonModal

Rectangle {
y: Screen.height - Screen.desktopAvailableHeight
width: Screen.desktopAvailableWidth
height: Screen.desktopAvailableHeight
color: "#a1a1a1"
}

Component.onCompleted: {
this.showNormal();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: