3

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.

QgsMessageBar

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)

2

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 '16 at 23:39
0

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, privacy policy and cookie policy

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