PDA

View Full Version : Add color to ui backgroung



maarvi
15th June 2011, 07:17
hello every one i have two questions

1)
i want to ask question regarding the interface designing in Qt creator.
in my inter face there is a LIST BOX few LABELs and a BUTTON. have colored the button its working well but when i tried to color the background by

right click on form -> change style sheet -> add gradient -> apply -> ok

the color changes but when i run the program it unexpectedly finishes. without color its working fine. any help plz

2)
is there a way to change a label color dynamically like if some value is one label color will be read and other wise green

thanks


i can also apply images(screen shots ) if any one want

i will be very thankfull

Santosh Reddy
15th June 2011, 07:37
right click on form -> change style sheet -> add gradient -> apply -> ok
right click on form -> change style sheet -> add gradient -> background-color - apply -> ok, also make sure QtDesigner should show the background color.


is there a way to change a label color dynamically like if some value is one label color will be read and other wise green
you can use setStyleSheet() in run time

maarvi
15th June 2011, 07:42
thank u sir but

in question no 1 i have done this but by setting background will make my program to finish unexpectedly. my list box color dont cause any problem but back color of whole form cause problem

Santosh Reddy
15th June 2011, 07:50
by problem you mean application crash?
Then thumb rule: did you clean the project and compile?
Can you post the style-sheet from the Qt Designer?
Also did you check the stack, if crashing is your problem.

the whole background being black should not be a problem for functionality, it will be very hard to find list box in dark.:)

maarvi
15th June 2011, 08:13
yes sir my application crashes

i have clean and compile but no use :(

here the pink color of the the back ground when i remove it i working well but when when i add pink or anyother color its working fine .

Santosh Reddy
15th June 2011, 08:30
not sure what's the reason..., did you try look at the stack

maarvi
15th June 2011, 08:57
yes sir its giving me the error in ui->setupUI(this)

Santosh Reddy
15th June 2011, 09:05
delete the ui_xxxx.h file from the disk, and the build the program, it if does not solve, you have to debug the the ui_xxxx.h file stepping in, and see where it crashes...