API Documentation
Documentation for developing SailfishOS applicationsViewPlaceholder QML Type
Shows a Sailfish-style fullscreen placeholder for an empty view More...
Import Statement: | import Sailfish.Silica 1.0 |
Properties
- enabled : bool
- hintText : string
- leftMargin : real
- rightMargin : real
- text : string
- textFormat : real
- verticalOffset : real
Detailed Description
A ViewPlaceholder is a fullscreen display that is shown to avoid displaying a blank page when the page content is unavailable.
It displays the specified text and hintText in the centre of the page to provide more information about the empty content state. If the view has an associated PullDownMenu, tapping on the ViewPlaceholder text will peek at the menu to indicate to the user that options may be available in the menu.
An example:
import QtQuick 2.2 import Sailfish.Silica 1.0 ApplicationWindow { initialPage: Component { Page { SilicaListView { id: view anchors.fill: parent header: PageHeader { title: "Example" } model: ListModel { id: listModel } delegate: BackgroundItem { width: ListView.view.width Label { text: model.date x: Theme.horizontalPageMargin anchors.verticalCenter: parent.verticalCenter } } ViewPlaceholder { enabled: view.count == 0 text: "No items yet" hintText: "Pull down to add items" } PullDownMenu { MenuItem { text: "Add item" onClicked: { listModel.append({"date": new Date().toLocaleTimeString()}) } } } } } } }
Note: A ViewPlaceholder must have a flickable Silica type in its parent hierarchy, such as a SilicaFlickable, SilicaListView, or SilicaGridView.
Property Documentation
Additional text placed below the main text to hint to the user as to how the empty state can be resolved.
The margins between the left and right edges of the placeholder and its contents. The default value is Theme.horizontalPageMargin.
The margins between the left and right edges of the placeholder and its contents. The default value is Theme.horizontalPageMargin.