I totally agree with yfede here. this is a bug and it should be fixed.
the following line in TextEditor::colourChanged() :
setOpaque (findColour (backgroundColourId).isOpaque());
makes the wrong assumption that the textEditor is fully painted with that backgroundColourId colour, without any rounded corners. This is a wrong assumption, as fillTextEditorBackground() is a customizable lookandfeel method.
To fix that, either setOpaque (findColour (backgroundColourId).isOpaque());
should be removed, either the following should be added at the beginning if TextEditor::paint() :
g.fillAll (findColour (TextEditor::backgroundColourId));
But at the moment, if you paint your textEditor with rounded corner :
void fillTextEditorBackground (Graphics& g, int w, int h, TextEditor& te) override
{
g.setColour (te.findColour (TextEditor::backgroundColourId));
float corner = 10.f;
g.fillRoundedRectangle (0.f, 0.f, (float) w, (float) h, corner);
}
that will result in un-painted black background corners. Everybody will loose time debugging and doing a workaround the first time they encounter that bug.
edit : Simple code to reproduce the issue :
// MainComponent.h
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
struct MyLookAndFeel : public LookAndFeel_V4
{
MyLookAndFeel()
{
setColour (TextEditor::outlineColourId, Colours::transparentWhite);
setColour (TextEditor::focusedOutlineColourId, Colours::transparentWhite);
setColour (TextEditor::backgroundColourId, Colours::red);
}
void fillTextEditorBackground (Graphics& g, int w, int h, TextEditor& te) override
{
g.setColour (findColour (TextEditor::backgroundColourId));
float corner = 10.f;
g.fillRoundedRectangle (0.f, 0.f, (float) w, (float) h, corner);
}
};
//==============================================================================
class MainContentComponent : public Component
{
public:
//==============================================================================
MainContentComponent()
{
textEditor.setLookAndFeel (&lnf);
textEditor.setOpaque (false);
addAndMakeVisible (textEditor);
setSize (600, 400);
}
void paint (Graphics& g) override
{
g.fillAll (Colours::lightgrey);
}
void resized() override
{
textEditor.setBounds (getLocalBounds().reduced (10).removeFromTop (20));
}
private:
//==============================================================================
MyLookAndFeel lnf;
TextEditor textEditor;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};