Button QML Type: Text Coloring
-
So I want to preface this all with a little about myself. I am completely new to posting on forums so if this is done incorrectly I do apologize. I have been lurking and using this forum as a resource to dive into Ubuntu Touch. I have only recently decided that I am going to develop apps for this OS and am fully sold on using this.
With all that being said I am working on my first app. It is a reading app based off creepypasta where you can find all kinds of stories focusing on creepy and horror. Currently working on basic UI and working with writers to get permission to add their stories.
I have hit a weird hurdle though. I am trying to add some buttons and maybe this because I am new to QML and the proper way of implementing things. However, I can set the background color using the color option, text string, iconName, but there seems to be no way to change the color of the text and/or icon with a button. This seems like a really massive oversight.
-
@NotZaney
Did you try the solutions proposed in the answers of this post?https://stackoverflow.com/questions/40823503/qml-button-change-text-color
-
@pparent Thank you for getting back so fast. The only thing I found that would work was wrapping the text string like so: text: "<font color='#000000'>Author</font". However, while this solution allows me to color the text it does not color the icon. The same trick obviously doesn't work for the icon.
I am just confused at why there is not already two options for text and icon color. I guess for now I am going to leave it alone. Although I would even be open to helping improve the API / adding these options at some point.
I am sure I could get the buttons working and looking exactly how I want them, but I am just not trying to have 30 lines of nested code to build out a button lol.
-
@NotZaney Are you using Lomiri toolkit? You might need to use Style. Check from docs if there's one for the button.
In any case, you can actually make your own component in QML if you want to customize the contents of the button. Just put it in a separate QML file.