Re: Minimum QGroupBox size
After changing the title try a:
Code:
int minW = fm.width(group->title());
group->setMinimumWidth(minW);
Re: Minimum QGroupBox size
Thanks for the suggestion Marcel. It doesn't quite seem to work though. I think I was a little unclear in my stating of the problem though. The title is set when the QGroupBox is constructed. It doesn't changed. The only thing about the QGroupBox that changes is its size. Does that change the problem a little bit?
Here's my attempt to implement the suggested code:
Code:
setTitle(title);
setLayout(theGrid);
int minW = fm.width(this->title());
setMinimumWidth(minW);
}
Re: Minimum QGroupBox size
I've tried messing around with the QFontMetrics, but I still can't quite seem to get it. In fact, it seems like for some reason, my QGroupBox won't respect any minimum width I set for it. If I call resize(sizeHint()) on it, it doesn't seem to be respecting the minimum width.