本文整理汇总了C++中QWebElement::setStyleProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebElement::setStyleProperty方法的具体用法?C++ QWebElement::setStyleProperty怎么用?C++ QWebElement::setStyleProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebElement
的用法示例。
在下文中一共展示了QWebElement::setStyleProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: highlightId
void QtWebKitHelpViewer::highlightId(const QString &id)
{
if (m_oldHighlightId == id)
return;
const QWebElement &document = m_webView->page()->mainFrame()->documentElement();
const QWebElementCollection &collection = document.findAll(QLatin1String("h3.fn a"));
const QLatin1String property("background-color");
foreach (const QWebElement &element, collection) {
const QString &name = element.attribute(QLatin1String("name"));
if (name.isEmpty())
continue;
if (m_oldHighlightId == name
|| name.startsWith(m_oldHighlightId + QLatin1Char('-'))) {
QWebElement parent = element.parent();
parent.setStyleProperty(property, m_oldHighlightStyle);
}
if (id == name
|| name.startsWith(id + QLatin1Char('-'))) {
QWebElement parent = element.parent();
m_oldHighlightStyle = parent.styleProperty(property,
QWebElement::ComputedStyle);
parent.setStyleProperty(property, QLatin1String("yellow"));
}
}
m_oldHighlightId = id;
}
示例2: filter
void PmrWindowWidget::filter(const QString &pFilter)
{
// Filter our list of exposures and remove any duplicates (they will be
// 'reintroduced' in the next step)
QStringList filteredExposureNames = mExposureNames.filter(QRegularExpression(pFilter, QRegularExpression::CaseInsensitiveOption));
mNumberOfFilteredExposures = filteredExposureNames.count();
filteredExposureNames.removeDuplicates();
// Update our message and show/hide the relevant exposures
page()->mainFrame()->documentElement().findFirst("p[id=message]").setInnerXml(message());
QWebElement trElement = page()->mainFrame()->documentElement().findFirst(QString("tbody[id=exposures]")).firstChild();
QWebElement ulElement;
for (int i = 0, iMax = mExposureNames.count(); i < iMax; ++i) {
if (mExposureDisplayed[i] != filteredExposureNames.contains(mExposureNames[i])) {
QString displayValue = mExposureDisplayed[i]?"none":"table-row";
trElement.setStyleProperty("display", displayValue);
ulElement = trElement.firstChild().firstChild().nextSibling();
if (ulElement.hasClass("visible"))
ulElement.setStyleProperty("display", displayValue);
mExposureDisplayed[i] = !mExposureDisplayed[i];
}
trElement = trElement.nextSibling();
}
}
示例3: updateBlockedPageElements
void QtWebKitWebPage::updateBlockedPageElements(const QStringList domainList, const bool isException)
{
for (int i = 0; i < domainList.count(); ++i)
{
const QList<QString> exceptionList = isException ? ContentBlockingManager::getHidingRulesExceptions().values(domainList.at(i)) : ContentBlockingManager::getSpecificDomainHidingRules().values(domainList.at(i));
for (int j = 0; j < exceptionList.count(); ++j)
{
const QWebElementCollection elements = mainFrame()->documentElement().findAll(exceptionList.at(j));
for (int k = 0; k < elements.count(); ++k)
{
QWebElement element = elements.at(k);
if (element.isNull())
{
continue;
}
if (isException)
{
element.setStyleProperty(QLatin1String("display"), QLatin1String("block"));
}
else
{
element.removeFromDocument();
}
}
}
}
}
示例4: retranslateUi
void PhysiomeModelRepositoryWindowWidget::filter(const QString &pFilter)
{
// Make sure that we have something to filter (i.e. no error message)
if (!mErrorMessage.isEmpty())
return;
// Filter our list of exposures, remove any duplicates (they will be
// reintroduced in the next step) and update our message (by retranslating
// ourselves)
QStringList filteredExposureNames = mExposureNames.filter(QRegularExpression(pFilter, QRegularExpression::CaseInsensitiveOption));
mNumberOfFilteredExposures = filteredExposureNames.count();
filteredExposureNames.removeDuplicates();
retranslateUi();
// Show/hide the relevant exposures
// Note: to call QWebElement::setStyleProperty() many times is time
// consuming, hence we rely on mExposureDisplayed to determine when we
// should change the display property of our elements...
QWebElement trElement = page()->mainFrame()->documentElement().findFirst(QString("tbody[id=exposures]")).firstChild();
QWebElement ulElement;
for (int i = 0, iMax = mExposureNames.count(); i < iMax; ++i) {
if (mExposureDisplayed[i] != filteredExposureNames.contains(mExposureNames[i])) {
QString displayValue = mExposureDisplayed[i]?"none":"table-row";
trElement.setStyleProperty("display", displayValue);
ulElement = trElement.firstChild().firstChild().nextSibling();
if (ulElement.hasClass("visible"))
ulElement.setStyleProperty("display", displayValue);
mExposureDisplayed[i] = !mExposureDisplayed[i];
}
trElement = trElement.nextSibling();
}
}