LookAndFeel_V4 breaks UI code

gui

#1

After upgrading from JUCE v4 to JUCE v5, our UI is completely broken. I’ve traced the issue to LookAndFeel_v4. The code is fine if I check out commit 3b422bef51ce741838ed54363efaaa502c7b1ca1, but breaks if I check out commit ef2c63e4e324b75cdb7e13dc5ff5d519d8b146a8 in the JUCE repo.

ToggleButtons and Labels are simply not rendered. Are there any obvious changes that were made from LookAndFeel_v3 to LookAndFeel_v4 that could cause this?


#2

If you run the JuceDemo and select the LookAndFeel demo, you can switch seamlessly between the different LookAndFeel versions.
To return to the previous look and feel, call in your constructor:

ScopedPointer<LookAndFeel> lnf;  // as member
setLookAndFeel (lnf = new LookAndFeel_V3());

If a child is added via addAndMakeVisible(), it get’s this look and feel set AFAIK.

Did you create your own LookAndFeel class?

The commit you linked as the breaking one seems to change mostly the examples, and adds the new LNF to be included… Does switching back to LNF_V3 resolve the issue?


#3

Yep, switching back to LookAndFeel_V3 fixes it. I’ll work with that for now.

I did not create my own LookAndFeel class.


#4

By default LookAndFeel_V4 uses a lot of dark colours, so if you’re drawing Labels and ToggleButtons on a dark background then perhaps it may look like they are not rendering. Can you try doing something like:

if (auto v4 = dynamic_cast<LookAndFeel_V4*> (&getLookAndFeel()))
    v4->setColourScheme (LookAndFeel_V4::getLightColourScheme());

in your constructor and seeing if this makes a difference?


#5

Hi ed95, that was it. Switching to light colour scheme, everything renders OK with LookAndFeelV4.