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

How to change programmatically an attr.styles? #42

Open
matzrm opened this issue Jan 5, 2018 · 1 comment
Open

How to change programmatically an attr.styles? #42

matzrm opened this issue Jan 5, 2018 · 1 comment

Comments

@matzrm
Copy link

matzrm commented Jan 5, 2018

Hi,

is there a way to programmatically change an attr.styles?

For example, I would transform SLabel's styles from text-info to text-danger when an error occurs. Is it possible?

Right now I'm changing the whole string style, also if I would like to remove only one class and add another one.

@tyler-gilbert
Copy link
Member

You just have to manipulate the text but you can do something like this:


property bool error: false;
property string labelStyle: error ? "label-danger" : "label-success";

SLabel {
   style: "text-info " + labelStyle;
}

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

2 participants