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


C++ MessageItem::comment方法代码示例

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


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

示例1: messageItem

MessageItem *ContextItem::findMessage(const QString &sourcetext, const QString &comment) const
{
    for (int i = 0; i < messageCount(); ++i) {
        MessageItem *mi = messageItem(i);
        if (mi->text() == sourcetext && mi->comment() == comment)
            return mi;
    }
    return 0;
}
开发者ID:kileven,项目名称:qt5,代码行数:9,代码来源:messagemodel.cpp

示例2: calcMergeScore

static int calcMergeScore(const DataModel *one, const DataModel *two)
{
    int inBoth = 0;
    for (int i = 0; i < two->contextCount(); ++i) {
        ContextItem *oc = two->contextItem(i);
        if (ContextItem *c = one->findContext(oc->context())) {
            for (int j = 0; j < oc->messageCount(); ++j) {
                MessageItem *m = oc->messageItem(j);
                if (c->findMessage(m->text(), m->comment()))
                    ++inBoth;
            }
        }
    }
    return inBoth * 100 / two->messageCount();
}
开发者ID:kileven,项目名称:qt5,代码行数:15,代码来源:messagemodel.cpp

示例3:

MessageItem *MessageModel::findMessage(const char *context, const char *sourcetext, const char *comment /*= 0*/) const
{
    for (int c = 0; c < cntxtList.count(); ++c) {
        ContextItem *ctx = cntxtList.at(c);
        if (ctx->context() == QLatin1String(context)) {
            QList<MessageItem*> items = ctx->messageItemList();
            for (int i = 0; i < items.count(); ++i) {
                MessageItem *mi = items.at(i);
                if (mi->sourceText() == QLatin1String(sourcetext)) {
                    if (comment) {
                        if (mi->comment() != QLatin1String(comment)) continue;
                    }
                    return mi;
                }
            }
            break;
        }
    }
    return 0;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:20,代码来源:messagemodel.cpp

示例4: findMessage

bool MessageModel::findMessage(int *contextNo, int *itemNo, const QString &findText, int findWhere, 
    bool matchSubstring, Qt::CaseSensitivity cs)
{
    bool found = false;
    if (contextsInList() <= 0)
        return false;

    int pass = 0;
    int scopeNum = *contextNo;
    int itemNum = *itemNo;

    MessageItem *m = 0;

    // We want to search the scope we started from *again*, since we did not necessarily search that *completely* when we started.
    // (Problaby we started somewhere in the middle of it.)
    // Therefore, "pass <=" and not "pass < " 
    while (!found && pass <= contextsInList()) {
        ContextItem *c = contextList().at(scopeNum);
        for (int mit = itemNum; mit < c->messageItemsInList() ; ++mit) {
            m = c->messageItem(mit);
            QString searchText;
            switch (findWhere) {
                case SourceText:
                    searchText = m->sourceText();
                    break;
                case Translations:
                    searchText = m->translation();
                    break;
                case Comments:
                    searchText = m->comment();
                    break;
            }
            if (matchSubstring) {
                if (searchText.indexOf(findText,0, cs) >= 0) {
                    found = true;
                    break;
                }
            } else {
                if (cs == Qt::CaseInsensitive) {
                    if (findText.toLower() == searchText.toLower()) {
                        found = true;
                        break;
                    }
                } else {
                    if ( findText == searchText ) {
                        found = true;
                        break;
                    }
                }
            }

        }
        itemNum = 0;
        ++pass;

        ++scopeNum;
        if (scopeNum >= contextsInList()) {
            scopeNum = 0;
            //delayedMsg = tr("Search wrapped.");
        }
    }

    if (found) {
        *itemNo = itemNum;
        *contextNo = scopeNum;
    }
    return found;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:68,代码来源:messagemodel.cpp


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