细心开发者如果发现我的以前开发的应用,主页面能够切换的地方,我放置了一个向右的箭头.比如在文章"从零开始创建一个Ubuntu应用 -- 一个小小的RSS阅读器 (1)"最下面的图片中,我们可以看到在列表中,有一个向右的箭头.
在我们的Ubuntu应用中,我们可以利用ListItemLayout来作为我们列表中的每一项的delegate.在这种情况下,我们可以充分利用ProgressionSlot来为我们添加上一个向右的">"符号.比如在下面的例子中:
Main.qml
import QtQuick 2.4
import Ubuntu.Components 1.3
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
// Note! applicationName needs to match the "name" field of the click manifest
applicationName: "progressionslot.liu-xiao-guo"
width: units.gu(60)
height: units.gu(85)
Page {
header: PageHeader {
id: pageHeader
title: i18n.tr("progressionslot")
StyleHints {
foregroundColor: UbuntuColors.orange
backgroundColor: UbuntuColors.porcelain
dividerColor: UbuntuColors.slate
}
}
ListItem {
anchors {
left: parent.leftt
right: parent.right
top: parent.header.bottom
}
height: layout.height + (divider.visible ? divider.height : 0)
ListItemLayout {
id: layout
title.text: "Hello developers!"
subtitle.text: "I'm a subtitle, I'm tiny!"
summary.text: "Ubuntu!"
CheckBox { SlotsLayout.position: SlotsLayout.Leading }
Icon {
name: "message"
SlotsLayout.position: SlotsLayout.Trailing;
width: units.gu(2)
}
ProgressionSlot {}
}
}
}
}
我们利用了一个ProgressionSlot.这样我们的ListItem显示为:
我们可以在上面的显示中,清楚地看见一个向右的箭头.这就是使用ProgressionSlot所带来的.