Results 1 to 8 of 8

Thread: Add color to ui backgroung

  1. #1
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Add color to ui backgroung

    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

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Add color to ui backgroung

    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

  3. #3
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: Add color to ui backgroung

    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

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Add color to ui backgroung

    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.

  5. #5
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: Add color to ui backgroung

    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 .
    Attached Images Attached Images

  6. #6
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Add color to ui backgroung

    not sure what's the reason..., did you try look at the stack

  7. #7
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: Add color to ui backgroung

    yes sir its giving me the error in ui->setupUI(this)

  8. #8
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Add color to ui backgroung

    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...

Similar Threads

  1. Replies: 2
    Last Post: 4th November 2016, 09:12
  2. Replies: 0
    Last Post: 19th January 2011, 12:49
  3. Replies: 3
    Last Post: 22nd January 2010, 16:46
  4. Display Label Color by selecting Color Picker
    By sosanjay in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 06:11
  5. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 22:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.