【问题标题】:How to make a horizontal pagination?如何进行横向分页?
【发布时间】:2015-09-24 18:06:29
【问题描述】:

我正在使用 Momentics IDE 2.1.2(本机 SDK)开发 BlackBerry 10 移动应用程序。

我正在寻找一个示例,该示例显示如何构建水平分页,如下图所示,我将把它放在一个容器中,替换为带有网格显示的列表视图。

谁能帮我解决这个问题?

【问题讨论】:

  • BB 级联中没有“StackView”。
  • 那么可能是NavigationPane
  • NavigationPage 或水平方向的ListView。至少有一个围绕后一种方法构建的StocQt 示例。
  • 是的,但可能是我的问题不清楚。实际上,我想要的只是在替换简单列表视图显示的项目之间建立一个水平分页,并且 navigationPane 仅适用于不在容器内的页面

标签: qt blackberry qml blackberry-10 cascade


【解决方案1】:

您可以仅使用ListView 轻松构建简单的分页。希望下面的例子有用:

import QtQuick 2.4

Item {
    width: 600
    height: 800

    ListView {
        id: listView
        anchors.fill: parent
        orientation: ListView.Horizontal
        snapMode: ListView.SnapToItem
        highlightRangeMode: ListView.StrictlyEnforceRange
        model: 5
        clip: true
        delegate: Rectangle {
            width: listView.width
            height: listView.height
            color: Qt.rgba(Math.random(),Math.random(),Math.random(),1);
            Text {
                anchors.centerIn: parent
                text: "page " + index
            }
        }
    }

    Item {
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        height: 30
        Row {
            anchors.centerIn: parent
            Repeater {
                model: listView.model
                Rectangle {
                    width: 20
                    height: 20
                    border.width:2
                    border.color: "white"
                    color: index == listView.currentIndex ? "orange" : "white"
                    Text {
                        anchors.centerIn: parent
                        text: index
                    }
                }
            }
        }
    }
}

【讨论】:

  • 问题是即使使用 BB 10.3.1,您也只能找到 QtQuick 1.0 和 QtQuick 1.1,我无法访问窗口或布局,因为它们不存在。
  • 啊,真的吗?为什么会这样? QtQuick 2 没有办法使用?
  • 我没有找到任何使这成为可能的东西。
  • FlickableRow 可能是可能的。 QtQuick1 中是否存在这些项目?
  • 我已更新我的答案以使其与 QtQuick1 一起使用。我无法测试它,但ListView 存在于 QtQuick1 中,我想它应该可以工作。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-04
  • 2012-02-28
  • 1970-01-01
  • 2011-11-13
  • 2018-03-15
相关资源
最近更新 更多