I'm developing a GUI theme for QGIS 2.12 using QSS (QSS is very similar to CSS, but for styling Qt widgets). This is new functionality introduced in 2.12 Pisa. So far, results have been encouraging!

I want to style the QgsMessageBar. As you can see here, the default message area is tiny, so you need to scroll for anything longer than a few lines. I'd like to make it deeper.


I tried adding this to my .qss file

QgsMessageBar {
    background-color: red;
    height: 100px;

This has no effect. It's valid QSS - if there were errors, styling would break down. I've also tried to style QgsMessageBarItem (which is the widget which contains the actual message).

I see it's possible to style QFrame (which QgsMessageBar inherits from). Here, I've added some padding and a thick black border - there's a lot of QFrames :) I want to style the message bar only, and leave the other QFrames alone.

After styling QFrames

After some experimentation I found this, which nearly works...

QFrame QFrame {
    height: 100px;

However, this seems to have an odd side-effect; it opens up a new Map Composer window in the background (!)

Any idea how I can do this?

(QGIS 2.12.2 Pisa; Ubuntu Tahr 32 bit)

3 Answers 3


As of 2.12 not yet. The style for the message bar is set in code. I'm working on fixing it for the next release so it can be styled using the QSS files.

  • thanks Nathan - that'll be great if the bar can be styled! Where should pull requests for potential new themes go, is it the LoadQSS plugin repo?
    – Steven Kay
    Jan 1, 2016 at 23:39

Meanwhile, in QGIS 3.22 it works. I got it with that code:

QFrame QFrame {
min-height: 70px;

QLineEdit {
border: 1px solid gray;
border-radius: 1px;
padding: 0 8px;
    selection-background-color: darkgray;
    border-color: darkgray

QTextEdit, QListView {
    border: 1px solid gray;

Currently it is not posible. If you want to share your themes with other users, you can create a pull request in the repository LoasQSS plugin repo and I will upload a new version. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.