Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Properties | List of all members
Settings Class Reference

Exposes the QSettings API to QML. More...

Properties

string category
 The category under which settings will be (re)stored.
string fileName
 The location of the file where the settings will be stored.

Detailed Description

Exposes the QSettings API to QML.

Each Settings instance can have a fileName and a category. Properties declared in QML will be automatically (re)stored.

import QtQuick 1.0
import org.hildon.components 1.0
import org.hildon.settings 1.0
Dialog {
id: dialog
title: qsTr("Settings Example")
height: column.height + platformStyle.paddingMedium
id: settings
property int number
property string text
fileName: "/home/user/.config/QtComponentsHildon/SettingsExample.conf"
}
Column {
id: column
anchors {
left: parent.left
right: button.left
bottom: parent.bottom
}
width: parent.width
text: qsTr("Text")
}
id: textField
width: parent.width
text: settings.text
}
id: numberButton
width: parent.width
text: qsTr("Number")
pickSelector: ListPickSelector {
id: numberSelector
model: 10
currentIndex: settings.number
}
}
}
Button {
id: button
anchors {
right: parent.right
bottom: parent.bottom
}
text: qsTr("Done")
onClicked: dialog.accept()
}
onAccepted: {
settings.text = textField.text;
settings.number = numberSelector.currentIndex;
}
Component.onCompleted: open()
}
Examples:
settings.qml.

Property Documentation

string Settings::fileName
readwrite

The location of the file where the settings will be stored.

By default, this property is an empty string, meaning that the location will be determined by QApplication::organizationName() and QApplication::applicationName().