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


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

本文整理汇总了C++中QWebElement::hasClass方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebElement::hasClass方法的具体用法?C++ QWebElement::hasClass怎么用?C++ QWebElement::hasClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWebElement的用法示例。


在下文中一共展示了QWebElement::hasClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onContextMenu

bool HistoryChatView::onContextMenu(ChatView *view, QMenu *menu, const QWebHitTestResult &result)
{
  ChatId id(view->id());
  if (id.type() != ChatId::ChannelId && id.type() != ChatId::UserId)
    return false;

  const QWebElement block = result.enclosingBlockElement();
  if (!block.hasClass("blocks") || block.hasClass("removed"))
    return false;

  const QWebElement container = block.parent();
  const qint64 mdate          = container.attribute(LS("data-mdate")).toLongLong();

  if (!mdate)
    return false;

  id.init(container.attribute(LS("id")).toLatin1());
  id.setDate(mdate);
  if (id.type() != ChatId::MessageId)
    return false;

  const int permissions = this->permissions(HistoryDB::get(id));
  if (permissions == NoPermissions)
    return false;

  if (permissions & Remove) {
    QVariantList data;
    data << view->id() << (id.hasOid() ? ChatId::toBase32(id.oid().byteArray()) : id.toString());

    menu->insertAction(menu->actions().first(), removeAction(data));
  }
  return true;
}
开发者ID:youngdev,项目名称:schat,代码行数:33,代码来源:HistoryChatView.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: filter

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

示例4: parseGAG

static QList<GagObject> parseGAG(const QWebElementCollection &entryItems)
{
    QList<GagObject> gagList;

    foreach (const QWebElement &element, entryItems) {
        GagObject gag;
        gag.setId(element.attribute("data-entry-id"));
        gag.setUrl(element.attribute("data-entry-url"));
        gag.setVotesCount(element.attribute("data-entry-votes").toInt());
        gag.setCommentsCount(element.attribute("data-entry-comments").toInt());
        gag.setTitle(element.findFirst("a").toPlainText().trimmed());

        gag.setIsLiked(!element.findFirst("ul.badge-item-vote-container.up").isNull());
        gag.setIsDisliked(!element.findFirst("ul.badge-item-vote-container.down").isNull());

        const QWebElement postContainer = element.findFirst("div.post-container");

        if (!postContainer.findFirst("div.nsfw-post").isNull()) {
            gag.setIsNSFW(true);
        } else if (!postContainer.findFirst("div.badge-animated-container-animated").isNull()) {
            gag.setIsGIF(true);
            gag.setImageUrl(postContainer.findFirst("img.badge-item-img").attribute("src"));
            gag.setGifImageUrl(postContainer.findFirst("div.badge-animated-container-animated").attribute("data-image"));
        } else if (postContainer.hasClass("with-button")) {
            //not full pic, we'll need to go deeper for the full lenght image
            const QUrl regularImgUrl = postContainer.findFirst("img.badge-item-img").attribute("src");
            const QUrl imgUrl = QString("%1/photo/%2_700b.jpg").arg(regularImgUrl.toString(QUrl::RemovePath)).arg(gag.id());

            Q_ASSERT(imgUrl.isValid());

            gag.setFullImageUrl(imgUrl);
            gag.setImageUrl(regularImgUrl);
            gag.setIsPartialImage(true);
        } else {
            gag.setImageUrl(postContainer.findFirst("img.badge-item-img").attribute("src"));
        }

        gagList.append(gag);
    }
开发者ID:b0bben,项目名称:GagBook,代码行数:39,代码来源:ninegagrequest.cpp


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