本文整理汇总了C++中plasma::QueryMatch::id方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryMatch::id方法的具体用法?C++ QueryMatch::id怎么用?C++ QueryMatch::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plasma::QueryMatch
的用法示例。
在下文中一共展示了QueryMatch::id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void PowerDevilRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
{
Q_UNUSED(context)
QDBusInterface iface("org.kde.Solid.PowerManagement",
"/org/kde/Solid/PowerManagement",
"org.kde.Solid.PowerManagement");
if (match.id().startsWith("PowerDevil_ProfileChange")) {
iface.asyncCall("loadProfile", match.data().toString());
} else if (match.id() == "PowerDevil_BrightnessChange") {
iface.asyncCall("setBrightness", match.data().toInt());
} else if (match.id() == "PowerDevil_DimTotal") {
iface.asyncCall("setBrightness", 0);
} else if (match.id() == "PowerDevil_DimHalf") {
iface.asyncCall("setBrightness", -2);
} else if (match.id() == "PowerDevil_TurnOffScreen") {
// FIXME: Maybe this should be even removed
// iface.asyncCall("turnOffScreen");
} else if (match.id().startsWith("PowerDevil_Suspend")) {
switch ((Solid::PowerManagement::SleepState)match.data().toInt()) {
case Solid::PowerManagement::SuspendState:
case Solid::PowerManagement::StandbyState:
iface.asyncCall("suspendToRam");
break;
case Solid::PowerManagement::HibernateState:
iface.asyncCall("suspendToDisk");
break;
}
}
}
示例2: 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);
}