本文整理汇总了C++中QTextBrowser::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::setSizePolicy方法的具体用法?C++ QTextBrowser::setSizePolicy怎么用?C++ QTextBrowser::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::setSizePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGui
//-----------------------------------------------------------------------------
QWidget* QmitkCmdLineModuleGui::getGui()
{
if (!d->m_TopLevelWidget)
{
// Construct additional widgets to contain full GUI.
QWidget *aboutBoxContainerWidget = new QWidget();
ctkCollapsibleGroupBox *aboutBox = new ctkCollapsibleGroupBox(aboutBoxContainerWidget);
aboutBox->setTitle("About");
QTextBrowser *aboutBrowser = new QTextBrowser(aboutBox);
aboutBrowser->setReadOnly(true);
aboutBrowser->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
aboutBrowser->setOpenExternalLinks(true);
aboutBrowser->setOpenLinks(true);
QVBoxLayout *aboutLayout = new QVBoxLayout(aboutBox);
aboutLayout->addWidget(aboutBrowser);
QVBoxLayout *aboutBoxContainerWidgetLayout = new QVBoxLayout(aboutBoxContainerWidget);
aboutBoxContainerWidgetLayout->addWidget(aboutBox);
QWidget *helpBoxContainerWidget = new QWidget();
ctkCollapsibleGroupBox *helpBox = new ctkCollapsibleGroupBox();
helpBox->setTitle("Help");
QTextBrowser *helpBrowser = new QTextBrowser(helpBox);
helpBrowser->setReadOnly(true);
helpBrowser->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
helpBrowser->setOpenExternalLinks(true);
helpBrowser->setOpenLinks(true);
QVBoxLayout *helpLayout = new QVBoxLayout(helpBox);
helpLayout->addWidget(helpBrowser);
QVBoxLayout *helpBoxContainerWidgetLayout = new QVBoxLayout(helpBoxContainerWidget);
helpBoxContainerWidgetLayout->addWidget(helpBox);
QObject* guiHandle = this->guiHandle();
QWidget* generatedGuiWidgets = qobject_cast<QWidget*>(guiHandle);
QWidget *topLevelWidget = new QWidget();
QGridLayout *topLevelLayout = new QGridLayout(topLevelWidget);
topLevelLayout->setContentsMargins(0,0,0,0);
topLevelLayout->setSpacing(0);
topLevelLayout->addWidget(aboutBoxContainerWidget, 0, 0);
topLevelLayout->addWidget(helpBoxContainerWidget, 1, 0);
topLevelLayout->addWidget(generatedGuiWidgets, 2, 0);
ctkCmdLineModuleDescription description = this->moduleReference().description();
QString helpString = "";
if (!description.title().isEmpty())
{
QString titleHtml = "<h1>" + description.title() + "</h1>";
helpString += titleHtml;
}
if (!description.description().isEmpty())
{
QString descriptionHtml = "<p>" + description.description() + "</p>";
helpString += descriptionHtml;
}
if (!description.documentationURL().isEmpty())
{
QString docUrlHtml = "<p>For more information please see <a href=\"" + description.documentationURL()
+ "\">" + description.documentationURL() + "</a></p>";
helpString += docUrlHtml;
}
QString aboutString = "";
if (!description.title().isEmpty())
{
QString titleHtml = "<h1>" + description.title() + "</h1>";
aboutString += titleHtml;
}
if (!description.contributor().isEmpty())
{
QString contributorHtml = "<h2>Contributed By</h2><p>" + description.contributor() + "</p>";
aboutString += contributorHtml;
}
if (!description.license().isEmpty())
{
QString licenseHtml = "<h2>License</h2><p>" + description.license() + "</p>";
aboutString += licenseHtml;
}
if (!description.acknowledgements().isEmpty())
{
QString acknowledgementsHtml = "<h2>Acknowledgements</h2><p>" + description.acknowledgements() + "</p>";
aboutString += acknowledgementsHtml;
}
//.........这里部分代码省略.........