Red star on labels

20 views
Skip to first unread message

Nahuel Aguilar

unread,
Jan 3, 2019, 9:37:03 AM1/3/19
to Enaml
I'm trying to set a red star by the end of a label for indicating that filling that field is required.
What is the best approach for making this?
Is it necessary to use two different labels, since they have different font colors?
If so, what is the clearest way to remove the gap between this labels? 
I'm using hbox for constraints.

Thanks and regards.

Matthieu Dartiailh

unread,
Jan 3, 2019, 10:16:50 AM1/3/19
to Nahuel Aguilar, Enaml
Hi,

One way to achieve what you want is to use HTML in the Label. This works mostly because Qt that is used for the UI accepts it (http://doc.qt.io/qt-5/richtext-html-subset.html). There may be a better way to do it but that is the easiest solution I could come up with.

In your case, the following text should work: "My text<font color=\"red\">*</font>

Best regards

Matthieu

--
You received this message because you are subscribed to the Google Groups "Enaml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enaml+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Colbert

unread,
Jan 3, 2019, 11:11:06 AM1/3/19
to Matthieu Dartiailh, Nahuel Aguilar, Enaml
You could also use an icon next to the label with zero spacing between them.
Reply all
Reply to author
Forward
0 new messages