[Interest] [QML] Override property value in some cases only

Alexander Dyagilev alervdvcw at gmail.com
Sat Oct 12 17:25:29 CEST 2024


Hello,

As example, let's suppose I would like to change font name for a TextField
only in case it contains "test" text.

What is the best way to do it in QML? Is there any special syntax maybe?

TextField {
    font.family: text.contains("test") ? "Inter" : DONT_CHANGE_PROPERTY
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20241012/8a262738/attachment.htm>


More information about the Interest mailing list