Results 1 to 6 of 6

Thread: How to apply style for widget over application style

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    8
    Thanked 133 Times in 128 Posts

    Default Re: How to apply style for widget over application style

    Qt Code:
    1. QWidget * w = new QWidget;
    2.  
    3. //any of these can reparent the widget.
    4. w->setParent(...);
    5. layout->addWidget(w);
    6. this->setLayout(layout);
    7.  
    8. w->setStyle(...);//This line should be at the end
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2011
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to apply style for widget over application style

    I have tried the code,

    QWidget * w = new QWidget;
    w->setParent( ui.listWidget );
    layout->addWidget( w );
    this->setLayout( layout );
    w->setStyle( new myWidgetStyle() );

    But I am unable setStyle For the Widget.
    The drawComplexControl function is called only if i set the CusomStyleClass in Applicationlevel.
    Eventhough i didnt set any app level style, and applying the style class only for the widget, the drawComplexControl function is not called and the style is not applied.

    The CustomStyle is applied only if i set the Style class in application Level.

    Thank you,
    Regards,
    muthu

  3. #3
    Join Date
    Sep 2011
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to apply style for widget over application style

    Thank you.
    I got it by taking the children from parent widget
    and applying style to subwidgets.

    Thanks and regards,
    muthu

Similar Threads

  1. Replies: 10
    Last Post: 13th August 2011, 08:10
  2. Replies: 5
    Last Post: 16th December 2010, 11:41
  3. Do Qt Style Sheets support List-style-image?
    By daiheitan in forum Qt Programming
    Replies: 6
    Last Post: 12th March 2010, 01:41
  4. Problems with Gradient style used through Style sheet on ARM platform
    By puneet.narsapur in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th January 2010, 12:48
  5. Replies: 1
    Last Post: 7th February 2007, 00:12

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.