本文整理汇总了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);
}
示例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();
}
示例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);
}
}
示例4: MatchItem
QueryMatchItem::QueryMatchItem(const Plasma::QueryMatch &match, QGraphicsWidget *parent)
: MatchItem(match.icon(), match.text(), match.subtext(), parent),
m_match(match)
{}