Results 1 to 3 of 3

Thread: How to apply a QStyle to a widget

  1. #1
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default How to apply a QStyle to a widget

    Hi! I'm trying to apply a custom style to a widget. It seems to work correctly when I try to apply it using:

    Qt Code:
    1. QApplication::setStyle(style);
    To copy to clipboard, switch view to plain text mode 

    but I would like to apply this only to a specific widget, so I tried:

    Qt Code:
    1. QGraphicsView* view = new QGraphicsView(this);
    2. view->setStyle(style);
    To copy to clipboard, switch view to plain text mode 

    but this seems not to work. Any idea why?
    Thanks!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to apply a QStyle to a widget

    Whats special about the style ?
    May be it doesnt have any special rendering for the graphics view,, check and let us know

  3. #3
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to apply a QStyle to a widget

    It draws the scrollbar, so yes, it should render differently the graphics view. If I apply it to QApplication, I get the scrollbars as expected, the other way I don't.
    Thanks for your answer!

Similar Threads

  1. How to Apply stylesheet to QMessageBox?
    By sudhansu in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2010, 08:32
  2. why font CSS can not apply to QPushButton on hover?
    By homerli in forum Qt Programming
    Replies: 0
    Last Post: 25th May 2009, 06:22
  3. Apply different scale on items
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2009, 06:59
  4. Where to apply transform? iterm or QPainter?
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2009, 08:40
  5. how to apply qt css to qtopia application
    By namita in forum Qt Programming
    Replies: 1
    Last Post: 3rd March 2008, 12:19

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.