PDA

View Full Version : QStackedLayout frustrations



qtLink
22nd November 2013, 20:01
1. Why, oh why, can't I set a container widget of my choosing to use QStackedLayout in designer?
2. Why, oh why, can't I set the stacking mode on a QStackedWidget when it's supposed to be a convenience class for QStackedLayout?

I've just been investigating using QStackedXXX for the first time this week so I'm sure it's possible I'm missing something, and there are good answers to my questions. For context, my high-level desire is for a toggleable attribute-value box. This widget should have a box frame, an attribute title in the upper-left corner, a field value somewhere in the center-ish, and the whole thing is clickable. When clicked, the value will switch between two possibilities. For now, I've been forced into implementing a QFrame with QStackedLayout in code in order to get what I want. I add two labels and a button as children to the frame and set the stacking mode to StackAll. This is exactly what I want but it was just way more work than it should have been.