Search code examples
qtstylesheetqlabel

Changing stylesheet causes qlabel to move


I have a few labels in a horizontal layout, and I want to enable/disable a border around the labels at certain times. I can do this using stylesheets, but the problem is that every time I enable/disable a border this way, the label shifts left or right in the layout by a few pixels.

This is an annoying artifact that takes away from the look of the UI. Does anyone know how to prevent this from happening?

Thanks!

Marlon


Solution

  • If your labels are on a plain background, then don't enable/disable the borders, just change the border colour to match the background.