本文整理汇总了C++中KDialog::setInitialSize方法的典型用法代码示例。如果您正苦于以下问题:C++ KDialog::setInitialSize方法的具体用法?C++ KDialog::setInitialSize怎么用?C++ KDialog::setInitialSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDialog
的用法示例。
在下文中一共展示了KDialog::setInitialSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: metrics
void ExtendedAboutDialog::Private::_k_showLicense( const QString &number )
{
KDialog *dialog = new KDialog(q);
dialog->setCaption(i18n("License Agreement"));
dialog->setButtons(KDialog::Close);
dialog->setDefaultButton(KDialog::Close);
const QFont font = KGlobalSettings::fixedFont();
QFontMetrics metrics(font);
const QString licenseText = aboutData->licenses().at(number.toInt()).text();
KTextBrowser *licenseBrowser = new KTextBrowser;
licenseBrowser->setFont(font);
licenseBrowser->setLineWrapMode(QTextEdit::NoWrap);
licenseBrowser->setText(licenseText);
dialog->setMainWidget(licenseBrowser);
// try to set up the dialog such that the full width of the
// document is visible without horizontal scroll-bars being required
const qreal idealWidth = licenseBrowser->document()->idealWidth() + (2 * dialog->marginHint())
+ licenseBrowser->verticalScrollBar()->width() * 2;
// try to allow enough height for a reasonable number of lines to be shown
const int idealHeight = metrics.height() * 30;
dialog->setInitialSize(dialog->sizeHint().expandedTo(QSize((int)idealWidth,idealHeight)));
dialog->show();
}