Results 1 to 9 of 9

Thread: Custom Style

  1. #1
    Join Date
    Jan 2006
    Posts
    32
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Custom Style

    Hello everybody,

    I wrote a custom style for my application, wrapped it within a plugin and put it in $QTDIR/plugins/styles.
    My applications are able to use, but designer is not, and I'm not able to preview forms with my style. Even qtconfig doesn't see it.

    What should I do to make designer aware of my style?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom Style

    Is QStyleFactory aware of your style?

  3. #3
    Join Date
    Jan 2006
    Posts
    32
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Custom Style

    Quote Originally Posted by jacek
    Is QStyleFactory aware of your style?
    I don´t think so, I thought it automatically parsed the folder like other apps. how can I make it aware?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom Style

    Quote Originally Posted by Dusdan
    how can I make it aware?
    It should should find that plugin all by itself, but if QStyleFactory doesn't know it, then Qt Designer won't know it either. Write a short program that creates QApplication instance and checks QStyleFactory::keys().

    What did you pass as the first parameter of the Q_EXPORT_PLUGIN2() macro? Did you compile your plugin in release mode? What is the name of the file with that plugin?

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

    Dusdan (1st June 2006)

  6. #5
    Join Date
    Jan 2006
    Posts
    32
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Custom Style

    Quote Originally Posted by jacek
    It should should find that plugin all by itself, but if QStyleFactory doesn't know it, then Qt Designer won't know it either. Write a short program that creates QApplication instance and checks QStyleFactory::keys().

    What did you pass as the first parameter of the Q_EXPORT_PLUGIN2() macro? Did you compile your plugin in release mode? What is the name of the file with that plugin?
    it was compiled in debug mode, now it works, thank you.

    I have another problem: when I use preview from the designer it doesn´t call the polish functions. since I implemented only those functions (just wanted to change colors and fonts) nothing changes in the previewed window.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom Style

    Quote Originally Posted by Dusdan
    when I use preview from the designer it doesn´t call the polish functions.
    How did you declare those methods? Maybe you have just implemented different methods (from compiler's point of view)? Make sure that they aren't marked as const.

  8. #7
    Join Date
    Jan 2006
    Posts
    32
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Custom Style

    Quote Originally Posted by jacek
    How did you declare those methods? Maybe you have just implemented different methods (from compiler's point of view)? Make sure that they aren't marked as const.
    no, they aren´t const. but now it comes to my mind that it can call polish(QApplication*) because there isn any application in the preview: is it right? so there´s no way to make the windows behave exactly as they will in a stand-alone application.

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom Style

    Quote Originally Posted by Dusdan
    is it right? so there´s no way to make the windows behave exactly as they will in a stand-alone application.
    I'm not sure, I haven't played with QStyle yet, but Qt Designer sets the new style only for the form and its children, not the QApplication instance.

  10. #9
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Custom Style

    I know I'm stepping in late with this question, but I ran across the same thing recently. Make sure your plugin doesn't have any external dependencies other (than Qt). If the style plugin links to a custom widget, then Designer can't use it. Your application can, because it has already loaded the object/library with that widget, but designer doesn't know anything about it.

Similar Threads

  1. Custom Qt dll name
    By tony007 in forum Installation and Deployment
    Replies: 2
    Last Post: 10th March 2006, 15:29
  2. Replies: 16
    Last Post: 7th March 2006, 15:57
  3. Replies: 4
    Last Post: 1st March 2006, 23:11
  4. image for a custom menu Item.......
    By Naveen in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2006, 09:28
  5. Bugs, style changes in 4.1.0?
    By simk in forum Qt Programming
    Replies: 13
    Last Post: 13th February 2006, 11:05

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.