我只是从文档中简单地复制了这个例子,并将导入版本号调整为最新的版本(但我尝试使用两个版本得到相同的结果)。
import QtQuick.Window 2.12
import Qt.labs.settings 1.1
Window {
id: window
width: 800
height: 600
Settings {
property alias x: window.x
property alias y: window.y
property alias width: window.width
property alias height: window.height
}
}
与所宣传的不同,当我关闭并重新打开窗口后,窗口几何图形未被保存。实际上,现在窗口根本就不显示了?(我尝试重新运行qmake并清理所有内容)
每次在Qt Creator中运行项目时,无论是否使用设置,我都会收到此警告:
17:01:02: Starting C:...debug\untitled.exe...
QML debugging is enabled. Only use this in a safe environment.
qrc:/main.qml:10:5: QML Settings: Failed to initialize QSettings instance. Status code is: 1
qrc:/main.qml:10:5: QML Settings: The following application identifiers have not been set: QVector("organizationName", "organizationDomain")
1) 这个警告与问题有关吗?
2) 我该如何去除这个警告?
3) 我该如何使广告中的设置生效?