本文整理汇总了C++中QTextBrowser::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::clear方法的具体用法?C++ QTextBrowser::clear怎么用?C++ QTextBrowser::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showDistroNews
/*
* At last we have to just show the retrivied news html
*/
void MainWindow::showDistroNews(QString distroRSSXML, bool searchForLatestNews)
{
QString html;
if (distroRSSXML.count() >= 200)
{
if (distroRSSXML.at(0)=='*')
{
/* If this is an updated RSS, we must warn the user!
And if the main window is hidden... */
if (isHidden())
{
show();
}
ui->twProperties->setTabText(ctn_TABINDEX_NEWS, "** " + StrConstants::getTabNewsName() + " **");
if (m_gotoNewsTab)
{
ui->twProperties->setCurrentIndex(ctn_TABINDEX_NEWS);
}
}
else
{
if(searchForLatestNews)
{
ui->twProperties->setTabText(ctn_TABINDEX_NEWS, StrConstants::getTabNewsName());
}
}
//First, we have to parse the raw RSS XML...
html = utils::parseDistroNews();
}
else
{
if(searchForLatestNews)
ui->twProperties->setTabText(ctn_TABINDEX_NEWS, StrConstants::getTabNewsName());
html = distroRSSXML;
}
//Now that we have the html table code, let's put it into TextBrowser's News tab
QTextBrowser *text = ui->twProperties->widget(ctn_TABINDEX_NEWS)->findChild<QTextBrowser*>("textBrowser");
if (text)
{
text->clear();
text->setHtml(html);
}
if (m_gotoNewsTab)
{
clearTabOutput();
}
if (searchForLatestNews && m_gotoNewsTab)
{
changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS);
}
ui->actionGetNews->setEnabled(true);
}
示例2: refreshDistroNews
/*
* This is the high level method that orquestrates the Distro RSS News printing in tabNews
*
* boolean parameter searchForLatestNews:
* controls whether this method tries to connect to the remote RSS News Feed (default is true)
* boolean parameter gotoNewsTab:
* controls whether this method must set the mainwindow focus to NewsTab (default is true)
*/
void MainWindow::refreshDistroNews(bool searchForLatestNews, bool gotoNewsTab)
{
qApp->processEvents();
if (searchForLatestNews)
{
LinuxDistro distro = UnixCommand::getLinuxDistro();
clearTabOutput();
if (distro == ectn_ARCHLINUX || distro == ectn_ARCHBANGLINUX)
{
writeToTabOutputExt("<b>" +
StrConstants::getSearchingForDistroNews().arg("Arch Linux") + "</b>");
}
else if (distro == ectn_CHAKRA)
{
writeToTabOutputExt("<b>" +
StrConstants::getSearchingForDistroNews().arg("Chakra") + "</b>");
}
else if (distro == ectn_MANJAROLINUX)
{
writeToTabOutputExt("<b>" +
StrConstants::getSearchingForDistroNews().arg("Manjaro Linux") + "</b>");
}
qApp->processEvents();
}
CPUIntensiveComputing *cic = new CPUIntensiveComputing;
QString distroRSSXML = retrieveDistroNews(searchForLatestNews);
delete cic;
QString html;
if (distroRSSXML.count() >= 200)
{
if (distroRSSXML.at(0)=='*')
{
/* If this is an updated RSS, we must warn the user!
And if the main window is hidden... */
if (isHidden())
{
show();
}
ui->twProperties->setTabText(ctn_TABINDEX_NEWS, "** " + StrConstants::getTabNewsName() + " **");
if (gotoNewsTab)
{
ui->twProperties->setCurrentIndex(ctn_TABINDEX_NEWS);
}
}
else
{
if(searchForLatestNews)
{
ui->twProperties->setTabText(ctn_TABINDEX_NEWS, StrConstants::getTabNewsName());
}
}
//First, we have to parse the raw RSS XML...
html = parseDistroNews();
}
else
{
if(searchForLatestNews)
ui->twProperties->setTabText(ctn_TABINDEX_NEWS, StrConstants::getTabNewsName());
html = distroRSSXML;
}
//Now that we have the html table code, let's put it into TextBrowser's News tab
QTextBrowser *text = ui->twProperties->widget(ctn_TABINDEX_NEWS)->findChild<QTextBrowser*>("textBrowser");
if (text)
{
text->clear();
text->setHtml(html);
}
clearTabOutput();
qApp->processEvents();
if (searchForLatestNews && gotoNewsTab)
{
_changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS);
}
}
示例3: getGui
//.........这里部分代码省略.........
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;
}
helpBrowser->clear();
helpBrowser->setHtml(helpString);
helpBox->setCollapsed(true);
aboutBrowser->clear();
aboutBrowser->setHtml(aboutString);
aboutBox->setCollapsed(true);
d->m_TopLevelWidget.reset(topLevelWidget);
}
return d->m_TopLevelWidget.data();
}