簡體   English   中英

QT QML Circle 和文本列表視圖

[英]QT QML Circle and a text listview

我想創建一個類似於下圖的 UI。 我知道 Qt Pathview 可以幫助我以循環方式移動項目。 但是我不知道如何創建類似於文本之間具有相等間距的圖像的背景。 我嘗試使用矩形(半徑:360)繪制圓形,但路徑視圖項不會沿着矩形圓的中心移動。

父布局 子布局(按下特定字符時)

也許這個簡單的例子可以幫助你使用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

                }
            }
        }
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM