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


C++ QueryMatch::subtext方法代码示例

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


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

示例1: matchesChanged

void KRunnerModel::matchesChanged(const QList< Plasma::QueryMatch > & m)
{
    QList< Plasma::QueryMatch > matches = m;

    qSort(matches.begin(), matches.end());

    clear();

    while (matches.size()) {
        Plasma::QueryMatch match = matches.takeLast();

        appendRow(
            StandardItemFactory::createItem(
                match.icon(),
                match.text(),
                match.subtext(),
                QString("krunner://") + match.runner()->id() + "/" + ::runnerManager()->query() + "#" + match.id(),
                match.relevance(),
                CommonModel::AddAction
                )
            );
    }

    sort(0, Qt::DescendingOrder);
}
开发者ID:aarontc,项目名称:kde-workspace,代码行数:25,代码来源:krunnermodel.cpp

示例2: data

QVariant SourcesModel::data(const QModelIndex& index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (index.row() >= m_size)
        return QVariant();

    Plasma::QueryMatch m = fetchMatch(index.row());
    Q_ASSERT(m.runner());

    switch(role) {
        case Qt::DisplayRole:
            return m.text();

        case Qt::DecorationRole:
            if (!m.iconName().isEmpty()) {
                return m.iconName();
            }

            return m.icon();

        case TypeRole:
            return m.matchCategory();

        case SubtextRole:
            return m.subtext();

        case ActionsRole: {
            const auto &actions = m_manager->actionsForMatch(m);
            if (actions.isEmpty()) {
                return QVariantList();
            }

            QVariantList actionsList;
            actionsList.reserve(actions.size());

            for (QAction *action : actions) {
                actionsList.append(QVariant::fromValue(action));
            }

            return actionsList;
        }
        case DuplicateRole:
            return m_duplicates.value(m.text());

            /*
        case PreviewTypeRole:
            return m.previewType();

        case PreviewUrlRole:
            return m.previewUrl();

        case PreviewLabelRole:
            return m.previewLabel();
            */
    }

    return QVariant();
}
开发者ID:KDE,项目名称:milou,代码行数:60,代码来源:sourcesmodel.cpp

示例3: run

void KopeteRunner::run(const Plasma::RunnerContext& context, const Plasma::QueryMatch& match)
{
    Q_UNUSED(context)

    // HACK: Strip off the "kopete_" prefix
    const QString id = match.data().toString();
    QString method;
    QVariantList args;
    if (id == "connect")
        method = "connectAll";
    else if (id == "disconnect")
        method = "disconnectAll";
    else if (id == "status")
    {
        method = "setOnlineStatus";
        QStringList status = match.text().split(": ");
        status.takeFirst();
        QStringList message = match.subtext().split(": ");
        message.takeFirst();
        args << status.join(": ") << message.join(": ");
    }
    else if (id == "message")
    {
        method = "setStatusMessage";
        QStringList message = match.text().split(": ");
        message.takeFirst();
        args << message.join(": ");
    }
    else if (!QUuid(id).isNull())
    {
        method = "openChat";
        args << id;
    }
    else
        qDebug("Unknown ID: %s", id.toUtf8().constData());
    if (!method.isNull())
    {
        QDBusMessage message = generateMethodCall(method);
        message.setArguments(args);
        QDBusConnection::sessionBus().send(message);
    }
}
开发者ID:KDE,项目名称:kdeplasma-addons,代码行数:42,代码来源:kopeterunner.cpp

示例4: MatchItem

QueryMatchItem::QueryMatchItem(const Plasma::QueryMatch &match, QGraphicsWidget *parent)
    : MatchItem(match.icon(), match.text(), match.subtext(), parent),
      m_match(match)
{}
开发者ID:aarontc,项目名称:kde-workspace,代码行数:4,代码来源:qs_querymatchitem.cpp


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