Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法将text显示到ui界面 #1

Open
w1245sdajda92771666KKnn opened this issue Dec 19, 2023 · 0 comments
Open

无法将text显示到ui界面 #1

w1245sdajda92771666KKnn opened this issue Dec 19, 2023 · 0 comments

Comments

@w1245sdajda92771666KKnn

无法将text中的内容显示到ui界面
import QtQuick 2.15
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import QtQml 2.12

//中间显示部分
Frame{

property var qmlList: [
    {icon:"recommend-white",value:"推荐内容",qml:"DetailRecommendPageView"},
    {icon:"recommend-white",value:"推荐内容",qml:"DetailRecommendPageView"},
    {icon:"recommend-white",value:"推荐内容",qml:"DetailRecommendPageView"},
    {icon:"recommend-white",value:"推荐内容",qml:"DetailRecommendPageView"},
    {icon:"recommend-white",value:"推荐内容",qml:"DetailRecommendPageView"},
    {icon:"recommend-white",value:"推荐内容",qml:"DetailRecommendPageView"}]


Layout.preferredWidth: 200
Layout.fillHeight: true
background: Rectangle{
    color: "#1000AAAA"
}
padding: 0//内边距

ListView{
    id: menuView
    height: parent.height
    Layout.fillHeight: true
    Layout.fillWidth: true
    model: ListModel{
        id: menuViewModel
    }
    delegate: menuViewDelegate
}

Component{
    id: menuViewDelegate
    Rectangle{
        id: menuViewDelegateItem
        height: 50
        width: 200
        color: "#00AAAA"
        RowLayout{
            anchors.fill: parent
            anchors.centerIn: parent
            spacing: 15

            Item {
                width: 30
            }

            Image{
                //source: "qrc:/images/"+icon
                source: "qrc:/images/"+icon
                Layout.preferredHeight: 20
                Layout.preferredWidth: 20
            }
            Text{
                text: value
                Layout.fillWidth: true
                height: 50
                //font.family: window.mFONT_FAMILY
                font.pointSize: 12
                //color: "#ffffff"
                 color: "#ff0000" // 设置颜色为红色

            }
        }
    }
}
Component.onCompleted: {
    menuViewModel.append(qmlList)
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant