Skip to content

Commit

Permalink
BitmapButton didn't correctly change style when Theme::replace was ca…
Browse files Browse the repository at this point in the history
…lled with a theme that let BitmapButton inherit its properties from Button

This probably affects some other widgets as well.
  • Loading branch information
texus committed Jul 12, 2024
1 parent 5c43e33 commit c68749b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Loading/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,20 @@ namespace tgui
}

existingRenderer = newRenderer;

// Update the existing widgets that were using the previous renderer from this theme
for (auto& observer : newRenderer->observers)
observer->setRenderer(newRenderer);

++existingRendererIt;
}

// Update the existing widgets that were using the previous renderer from this theme.
// We do this in a separate loop because all renderers need to be replaced before
// we tell the observers (because e.g. an observer of the BitmapButton renderer might
// want to access the Button renderer of the theme to inherit properties).
for (auto pair : m_renderers)
{
const auto& renderer = pair.second;
for (auto& observer : renderer->observers)
observer->setRenderer(renderer);
}

// Add the renderers that only existed in the other renderers (e.g. added via the addRenderer function)
for (const auto& otherRendererPair : otherTheme.m_renderers)
{
Expand Down

0 comments on commit c68749b

Please sign in to comment.