ENH: Better default size for help dialog.

This commit is contained in:
Clinton Stimpson 2008-03-28 12:53:31 -04:00
parent 79e581ab80
commit 369379f0c6
1 changed files with 4 additions and 1 deletions

View File

@ -393,15 +393,18 @@ void CMakeSetupDialog::doHelp()
"directory."); "directory.");
QDialog dialog; QDialog dialog;
QFontMetrics met(this->font());
int msgWidth = met.width(msg);
dialog.setMinimumSize(msgWidth/15,20);
dialog.setWindowTitle(tr("Help")); dialog.setWindowTitle(tr("Help"));
QVBoxLayout* l = new QVBoxLayout(&dialog); QVBoxLayout* l = new QVBoxLayout(&dialog);
QLabel* lab = new QLabel(&dialog); QLabel* lab = new QLabel(&dialog);
l->addWidget(lab);
lab->setText(msg); lab->setText(msg);
lab->setWordWrap(true); lab->setWordWrap(true);
QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok, QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
Qt::Horizontal, &dialog); Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept())); QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
l->addWidget(lab);
l->addWidget(btns); l->addWidget(btns);
dialog.exec(); dialog.exec();
} }