Results 1 to 4 of 4

Thread: Stop QDialog from inheriting parent's palette.

  1. #1
    Join Date
    Jan 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Question Stop QDialog from inheriting parent's palette.

    Hi, I wonder if someone can help me out here. I have got a QDialog with custom stylesheet (basically background color). In that Dialog I show another Dialog. When the other Dialog shows, it does so using the first Dialogs palette i.e. background.

    How can I prevent that the Second Dialog should not use the first Dialog's palette, but use it's own?

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Stop QDialog from inheriting parent's palette.

    How you are setting the style sheet for first dialog ?

  3. #3
    Join Date
    Jan 2009
    Posts
    14
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Stop QDialog from inheriting parent's palette.

    In the designer.

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Stop QDialog from inheriting parent's palette.

    Ok this is clear, you are setting some style sheet for QDialog, so every QDialog in the project will have the same style sheet.
    If you want to apply the style sheet for one particular dialog, you have to do something like this:
    Qt Code:
    1. //Lets assume your QDialog instance name is dlg.
    2. QDialog#dlg {
    3. background-color: green;
    4. }
    To copy to clipboard, switch view to plain text mode 
    This will change the style sheet of only one dialog.

    For more selectors here.

  5. The following user says thank you to yogeshgokul for this useful post:

    Avrohom (8th September 2009)

Similar Threads

  1. Replies: 7
    Last Post: 12th January 2011, 22:01
  2. How to stop event loop of QDialog in Qt4
    By node_ex in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2008, 07:19
  3. QDialog - how to stop hide on "ESC"?
    By will49 in forum Qt Programming
    Replies: 2
    Last Post: 27th May 2008, 16:40

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.