Results 1 to 6 of 6

Thread: Setting a Style Issue

  1. #1
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Setting a Style Issue

    For my main program I set the style by doing something like this:
    Qt Code:
    1. QApplication app(argc, argv);
    2. app.setStyle(QStyleFactory::create("cleanlooks"));
    To copy to clipboard, switch view to plain text mode 

    Later on in one of my widgets, I make the widget push-pin-able. However, when the widget is placed in a new window it does not use the CleanLooks style...instead it uses the systems default style. How can I make it use the main applications style (CleanLooks)? Below is what I have attempted:
    Qt Code:
    1. Qt::WindowFlags flags = Qt::Window;
    2. flags |= Qt::WindowStaysOnTopHint;
    3. setWindowFlags(flags);
    4. this->setStyle(QStyleFacory::create("cleanlooks"));
    5. setVisible(true);
    To copy to clipboard, switch view to plain text mode 

    Any pointers would be great.

  2. #2
    Join Date
    Jan 2006
    Location
    Edmonton, Canada
    Posts
    101
    Thanks
    13
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Setting a Style Issue

    Can you give a little more info, please? I'm not sure what you mean by "placing the widget in a new window". Is it still part of the same QApplication? Generally once you set the style for an application widgets will default to that style.

    Are you able to get your widget to use the CleanLooks style when it's not in a new window? Or does the style not work at all for that widget?

  3. #3
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Setting a Style Issue

    At first the push-pin widget is displayed within another widget (and does paint with the CleanLooks style). Example:

    Qt Code:
    1. ----------------------------
    2. | Main Widget |
    3. | ----------------- | // Both have Clean Looks Style
    4. | | Push-Pin | |
    5. | | Widget | |
    6. | ----------------- |
    7. | |
    8. ----------------------------
    To copy to clipboard, switch view to plain text mode 

    When I run the code shown below, the Push-Pin Widget displays in it's own window (which is what I want), however it no longer uses the CleanLooks style.
    Qt Code:
    1. Qt::WindowFlags flags = Qt::Window;
    2. flags |= Qt::WindowStaysOnTopHint;
    3. setWindowFlags(flags);
    4. this->setStyle(QStyleFacory::create("cleanlooks"));
    5. setVisible(true);
    6.  
    7. ----------------------------
    8. | Main Widget | // Main Widget has CleanLooks Style
    9. | | -----------------
    10. | | | Push-Pin |
    11. | | | Widget |
    12. | | -----------------
    13. | | // Push-Pin widget does not have CleanLooks
    14. ----------------------------
    To copy to clipboard, switch view to plain text mode 

    My goal is to get the Push-Pin Widget to always use the CleanLooks style.

    Hope this clarifies
    Last edited by forrestfsu; 28th March 2007 at 21:16.

  4. #4
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Setting a Style Issue

    Ahh...so frustrating. I just realized that this situation has nothing to do with the style. The style is being passed on to the Push-Pin Widget, however a coworker changed the Palette on the widget...so items displayed differently (and stupid me, I took that to be a sign of a different style). Thanks for all the help though...

  5. #5
    Join Date
    Jan 2006
    Location
    Edmonton, Canada
    Posts
    101
    Thanks
    13
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Setting a Style Issue

    No problem. Glad you got it resolved 'cause I was having a tough time figuring out what was going wrong there

  6. #6
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Setting a Style Issue

    Ha, I'm glad also...thanks for looking into it for me.

Similar Threads

  1. about scrollbar style
    By qtopiahooo in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2007, 13:34
  2. Setting style in QApplication
    By Doug Broadwell in forum Newbie
    Replies: 2
    Last Post: 28th October 2006, 21:56
  3. form setting
    By mickey in forum Qt Tools
    Replies: 5
    Last Post: 27th September 2006, 00:28
  4. Custom Style
    By Dusdan in forum Qt Tools
    Replies: 8
    Last Post: 1st September 2006, 22:50
  5. Another MacOS issue ?!
    By Nemo in forum Qt Programming
    Replies: 3
    Last Post: 14th February 2006, 09:16

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.