I am working in various Linux distributions, which may or may not be relevant. I have a QToolBar containing QToolButtons. One of the button labels toggles back and forth between two different texts when the button is pressed. The two labels happen by good fortune to be the same number of letters. I find that when the program is built in some environments, then the very first time I press the button and toggle to the alternate text, all of the toolbar buttons expand vertically (thickness) to occupy the full thickness of the toolbar. I am not switching fonts or anything. Thereafter, when I toggle the text back and forth, nothing changes. This initial re-sizing the first time the button is pressed isn't very desirable, because it makes the thing look amateurish (truthfully, I am a Qt amateur). I tried some things with QSizePolicy, but to no avail. Finally, what I resorted to was that right after the show() command for the window I setText() for the button to the alternate text and then immediately back to the original text to get the resizing out of the way. It all happens too quickly for the user to see. It just seems like a bad way to do it and I wondered if there were another way. I don't really know why the buttons are "slender" initially and then get thicker when the alternate text first appears. Here is my code:
// Toolbar
QToolBar *tool = new QToolBar(createTicketWindow);
tool->setGeometry(2,5,546,20);