Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
209 views
in Technique[技术] by (71.8m points)

How to draw a single sided line border in QML

I've got 3 basic elements in a rectangle and I'd like to draw line separations between them.
I don't find an easy way to achieve that, as a border-left would do in CSS.

Text {
    id : txtNote
    text : (__notes.length>0)?__notes[0].extname.name:"--"
    anchors.right: txtNoteAcc.left
    leftPadding: 5
    rightPadding: 0
}

Image {
    id : txtNoteAcc
    height : 20
    width : 20
    anchors.right: txtNoteHead.left
}

Image {
    id : txtNoteHead
    height : 20
    width : 20
    anchors.right: parent.right
}

Now laid out as:

enter image description here

And the goal is to have it a similar way (this example is a Java one):

enter image description here

I've found this approach, but I don't call it "simple" and it is 7 years old.

Rem: I'm working with QML 5.9 (so Shape is not available).

question from:https://stackoverflow.com/questions/65903236/how-to-draw-a-single-sided-line-border-in-qml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...