Changing appearence of mainwindow according to end user
Hi
I have GUI to which i want to give user the choice changing the colour of the mainwindow according to his wish. This means when the user runs the application i want to give him a settings button in which he can choose background color for the gui and font type for the gui etc. I dont know how to proceed... kindly help
Re: Changing appearence of mainwindow according to end user
Re: Changing appearence of mainwindow according to end user
Re: Changing appearence of mainwindow according to end user
Thanks... But in stylesheets i found that i can change background color, ie if i change the gui to blue, it will be blue when the end user runs it. I want to give the end user the choice to change the background color, insted of me forcing a color of my choice on him.
Re: Changing appearence of mainwindow according to end user
Don't see the problem... You can generate QSS on-the-fly... Or use Amleto's suggestion.
Re: Changing appearence of mainwindow according to end user
The problem is i dont want hardcode the background color and font style of my choice . I want to give end user to have his choice changing the appearance ...like you set taskbar color in windows7... I hope i am clear this time...
Using stylesheet
background-color: rgb(42, 84, 127); //
it will set the background color to blue... end user cant change it...
I want to give him a settings button through which he can change the appearance...
When the user changes the color to red it should change immediately...
Re: Changing appearence of mainwindow according to end user
Don't hard code it :) Use UI to change the color then set it into style sheet. Really don't get why it's so hard for you. :)
Re: Changing appearence of mainwindow according to end user
Hey..I used this,but whatever i give as input.. blue, white,yellow..it sets it as black itself..
Code:
void MainWindow::on_Set_clicked()
{
s=ui->bcolor->text();//textbox from wher i get input from user
qApp->setStyleSheet("QLineEdit { background-color:s }");
}
Re: Changing appearence of mainwindow according to end user
I would change the code like this:
Code:
void MainWindow::on_Set_clicked()
{
s=ui->bcolor->text();//textbox from wher i get input from user
qApp
->setStyleSheet
(QString("QLineEdit { background-color:%1 }").
arg(s
));
}
You would also need to check entered value in a lineEdit or use QColorDialog with QColor::name to select necessary color.
Re: Changing appearence of mainwindow according to end user
Thanks..It worked..
spirit U Rock!!!
Re: Changing appearence of mainwindow according to end user
You are welcome. It's not me, it's docs ;)