【问题标题】:QT QML Circle and a text listviewQT QML Circle 和一个文本列表视图
【发布时间】:2019-12-06 15:56:31
【问题描述】:

我想创建一个类似于下图的 UI。我了解 Qt Pathview 帮助我以循环方式移动项目。但我不知道如何创建与文本之间具有相等间距的图像相似的背景。我尝试用矩形(半径:360)画圆,但路径视图项目不会沿着矩形圆的中心移动。

【问题讨论】:

  • 你的解释不清楚。请在图片中说明您的意思。
  • 请澄清您的问题。正如@SoheilArmin 已经说过的,请提供您想要获得的清晰图像,一些草图或其他任何东西。请提供 Minimal, Reproducible Example 您尝试这样做以及您得到的结果。

标签: qt listview qml


【解决方案1】:

也许这个简单的例子可以帮助你PathView

import QtQuick 2.12
import QtQuick.Window 2.12

Window {
    visible: true
    width: 400
    height: 400

    Item {
        id: container
        width: 300
        height: 300
        anchors.centerIn: parent
        Rectangle {
            anchors.fill: parent
            radius: width /2
            color: "orange"
            Rectangle {
                x: 50
                y: 50
                width: 200
                height: 200
                radius: 100
                color: "white"
            }
        }

        PathView {
            anchors.fill: parent
            model: 10
            delegate: Rectangle {
                width: 50
                height: 50
                radius: 25
                color: "green"
            }
            path: Path {
                startX: 150; startY: 25

                PathArc {
                    x: 150; y: 275
                    radiusX: 125; radiusY: 125
                    direction: PathArc.Clockwise

                }
                PathArc {
                    x: 150; y: 25
                    radiusX: 125; radiusY: 125
                    direction: PathArc.Clockwise

                }
            }
        }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多