Styling Qt Widgets Using Style Sheets

An introduction to the concept of using CSS-based style sheets to customize the UI appearance

Up until Qt 4.2, the appearance of Qt widgets was modified by changing the palette and/or by subclassing QStyle. In either case the style was tied to the code and modifications required a tedious compile. Starting 4.2, Qt introduces a new concept of styling widgets using Style Sheets. “Style Strings” or Style Sheets can be attached to widgets and be modified on the fly. Style Sheets are similar in syntax and concept to Cascading Style Sheets (CSS) so graphic designers will feel right at home while creating new styles for your application. Customizing the appearance of Qt Applications has never been simpler and, thanks to Qt Designer, style previews are instantaneous. This talk addresses the syntax and concepts of a Style Sheet.


  • Widget appearance
  • What´s a Style Sheet
  • Style Sheets Syntax
  • Selectors
  • Pseudo States
  • The Box ModelQt Style Sheet Box Model Attributes
  • Border ImageStyle Sheet Computation
  • Sub Controls
  • Sub Control Positioning
  • Positioning Modes
  • Relative Positioning
  • Absolute Positioning
  • DEMO
  • Qt Specific Attributes


No comments

Write a comment

Sorry, you must be logged in to post a comment.