Skip to content

Creating decorations

gustavosbarreto edited this page Sep 14, 2010 · 19 revisions

Introduction

The window decoration styles are made with Qt Style Sheets. You only need to read the Qt Style Sheets document and follow certain naming rules to create a new style.

Naming rules

The directory which contains the source code of the style must contain three required files:

  • info.ini – Contains information about the style (name, author)
  • style.qss – Contains a textual description of customizations to the decoration’s style
  • resources.qrc – The Resource collection files (the resource prefix must be “/styles/stylename”)

Styleable objects

Some objects can be decorated with the “id selector”.

  • Frame – Decoration frame
  • TitleBar – Title bar of the decoration
  • ButtonContainer – Container of the buttons
  • CloseButton – Cose button
  • MinimizeButton – Minimize button
  • MaximizeButton – Maximize button

To decorate the frame according to the state of decoration (active, inactive) the “property selector” can be used (use the “active” property to this).

Deployment

First, you need to compile the style using the Qt resource compiler:
rcc -binary -o mystyle.rcc resources.qrc

Now you have the compiled style ready to distribute (mystyle.rcc)

Example

This example is based on metacity theme “Ambiance”. Preview:

Files

You can see the files here or download them.