PDA

View Full Version : Setting style sheet of ui in main window class from dialog class



shivendra46d
10th January 2014, 07:34
I want to set style sheet of ui in main window class form a dilog class which opens another ui.
Here is my sample code
9920992199229923

anda_skoa
10th January 2014, 10:10
You don't say what your problem is, so I am guessing: move the signal/slot connect before the call to exec()



Dialog *d = new Dialog;
connect(d, SIGNAL(update(QString)),this,SLOT(Set_style_Sheet( QString)));
d->exec();


Btw, creating a dialog with new and not deleting it results in memory loss.

Cheers,
_

shivendra46d
10th January 2014, 10:24
My problem was that i was unable to change the color form the dialog class, thanks your suggestion helped me, now i want that the changed style sheet to be loaded next time when i execute program can you suggest me a way to do so

anda_skoa
10th January 2014, 16:11
Save it on change or program exit and load and apply on program startup?
Using QSettings maybe?

Cheers,
_

shivendra46d
13th January 2014, 07:36
I want to save it on change and the new setting to be reflected at the same time also when the program is reloaded it should run with the changed setting

anda_skoa
13th January 2014, 09:24
Then you save it on change and load it on startup.

You can do the saving in the Set_style_Sheet slot. You can do the loading in the window's constructor.

Cheers,
_