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:
setTitle(title);
setLayout(theGrid);
int minW = fm.width(this->title());
setMinimumWidth(minW);
}
ETGroupBox::ETGroupBox(const QString &title, QWidget *parent):QGroupBox(parent){
setTitle(title);
theGrid = new QGridLayout();
setLayout(theGrid);
QFontMetrics fm(this->font());
int minW = fm.width(this->title());
setMinimumWidth(minW);
}
To copy to clipboard, switch view to plain text mode
Bookmarks