Example #1
0
void SymbolsFindFilter::openEditor(const SearchResultItem &item)
{
    if (!item.userData.canConvert<IndexItem::Ptr>())
        return;
    IndexItem::Ptr info = item.userData.value<IndexItem::Ptr>();
    EditorManager::openEditorAt(info->fileName(), info->line(), info->column());
}
Core::LocatorFilterEntry CppFunctionsFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
{
    const QVariant id = qVariantFromValue(info);

    QString name = info->symbolName();
    QString extraInfo = info->symbolScope();
    info->unqualifiedNameAndScope(name, &name, &extraInfo);
    if (extraInfo.isEmpty()) {
        extraInfo = info->shortNativeFilePath();
    } else {
        extraInfo.append(" (" + Utils::FileName::fromString(info->fileName()).fileName() + ')');
    }

    Core::LocatorFilterEntry filterEntry(this, name + info->symbolType(), id, info->icon());
    filterEntry.extraInfo = extraInfo;

    return filterEntry;
}
void CppLocatorFilter::accept(Core::LocatorFilterEntry selection) const
{
    IndexItem::Ptr info = qvariant_cast<IndexItem::Ptr>(selection.internalData);
    Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column());
}