Results 1 to 10 of 10

Thread: Overwriting custom widget stylesheet from mainWindow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Overwriting custom widget stylesheet from mainWindow

    Ok. Good to know the limitation. Working at runtime is a good enough solution.

    I had been looking at this: QDesignerFormWindowInterface

    But still wasn't able to access the main window.
    Thanks for replying so quickly.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Overwriting custom widget stylesheet from mainWindow

    I had been looking at this: QDesignerFormWindowInterface

    But still wasn't able to access the main window.
    Heh, you are one step ahead of me, the trolls have added so much in last few Qt releases, that I have trouble to keep up, speically with such not very often used classes.
    From a brief look in to QDesignerFormWindowInterface, I think that just might be what you are looking for.
    Have a look at QDesignerFormEditorInterface::formWindowManager (), and then in QDesignerFormWindowManagerInterface.
    I am almost certain that this will allow you to get the form styleSheet on which your custom widget is dropped.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Overwriting custom widget stylesheet from mainWindow

    I finally got it working:
    Qt Code:
    1. form = QDesignerFormWindowInterface::findFormWindow(widget);
    2. form->mainContainer()->styleSheet();
    To copy to clipboard, switch view to plain text mode 
    This works for the designer.

Similar Threads

  1. Using custom Q_PROPERTY with Stylesheet
    By hubbobubbo in forum Qt Programming
    Replies: 7
    Last Post: 30th September 2010, 10:48
  2. How to use stylesheet of custom widget
    By luochen601 in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2010, 10:10
  3. Replies: 10
    Last Post: 29th May 2010, 18:42
  4. Usability of StyleSheet in Pure Custom Widget Plugin?
    By umituzun84 in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2010, 14:22
  5. Add a custom widget in code to a MainWindow
    By Steff in forum Qt Programming
    Replies: 2
    Last Post: 19th November 2009, 07:17

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
  •  
Qt is a trademark of The Qt Company.