当前位置: 首页>>代码示例>>C++>>正文


C++ QWebElement::setStyleProperty方法代码示例

本文整理汇总了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;
}
开发者ID:acacid,项目名称:qt-creator,代码行数:29,代码来源:qtwebkithelpviewer.cpp

示例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();
    }
}
开发者ID:fethio,项目名称:opencor,代码行数:35,代码来源:pmrwindowwidget.cpp

示例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();
				}
			}
		}
	}
}
开发者ID:mboevink,项目名称:otter,代码行数:31,代码来源:QtWebKitWebPage.cpp

示例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();
    }
}
开发者ID:Fairly,项目名称:opencor,代码行数:44,代码来源:physiomemodelrepositorywindowwidget.cpp


注:本文中的QWebElement::setStyleProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。