import "/usr/lib/qt4/imports/com/nokia/meego/UIConstants.js" as UiConstants
Page {
+ property variant stationView
id: stationListPage
anchors.margins: UiConstants.DEFAULT_MARGIN
tools: ToolBarLayout {
{
var component = Qt.createComponent("StationPage.qml");
if (component.status == Component.Ready) {
- pageStack.push(component)
- component.html = "<p>Hello World</p>"
+ var view = component.createObject(stationListPage)
+ stationListPage.stationView = view
+ pageStack.push(view)
+ view.html = "<h1>Hello World</h1><p>Lorem ipsum</p>"
}
else
- console.log("Cannot load component: " + component.errorString());
+ console.log('Cannot load component: ' + component.errorString());
+ }
+
+ function highlightSearch(s)
+ {
+ return s.replace(searchField.text,
+ '<span style="text-decoration:underline">' +
+ searchField.text + '</span>')
}
Column {
width: parent.width
height: parent.height
TextField {
+ id: searchField
width: parent.width
placeholderText: "Search..."
+ platformStyle: TextFieldStyle { paddingRight: clearButton.width }
+ onTextChanged: {
+ listView.model = null
+ listView.model = model
+ }
+ Image {
+ id: clearButton
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ source: "image://theme/icon-m-input-clear"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ inputContext.reset()
+ searchField.text = ""
+ }
+ }
+ }
+ }
+ Rectangle {
+ height: 16
}
ListView {
id: stationListView
+ clip: true
width: parent.width
height: parent.height
model: ListModel {
+ id: model
+ ListElement {
+ name: "Genova Voltri"
+ }
ListElement {
name: "Genova Sestri Ponente"
}
name: "Genova Sampierdarena"
}
ListElement {
+ name: "Genova Via di Francia"
+ }
+ ListElement {
name: "Genova Piazza Principe"
}
ListElement {
}
delegate: Item {
id: listItem
- height: 88
+ height: 48
width: parent.width
BorderImage {
id: background
Label {
id: mainText
- text: model.name
+ text: highlightSearch(model.name)
font.bold: true
//font.family: UiConstants.FONT_FAMILY
//font.pixelSize: UiConstants.FONT_DEFAULT
import QtWebKit 1.0
Page {
- property string html: "<p>Hello</p>"
+ property alias html: view.html
anchors.fill: parent
tools: ToolBarLayout {
ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
}
+ LabelStyle {
+ id: labelStyle
+ }
WebView {
id: view
anchors.fill: parent
+ settings.defaultFontSize: labelStyle.fontPixelSize
+ settings.defaultFixedFontSize: labelStyle.fontPixelSize
+ settings.standardFontFamily: labelStyle.fontFamily
}
}