static AssistProposalItem *createCompletionItem(const QString &text, const QIcon &icon, int order = 0) { AssistProposalItem *item = new AssistProposalItem; item->setText(text); item->setIcon(icon); item->setOrder(order); return item; }
IAssistProposal *immediateProposal(const AssistInterface *) override { QTC_ASSERT(m_params.function, return 0); AssistProposalItem *hintItem = new VirtualFunctionProposalItem(TextEditorWidget::Link()); hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor", "...searching overrides")); hintItem->setOrder(-1000); QList<AssistProposalItem *> items; items << itemFromFunction(m_params.function); items << hintItem; return new VirtualFunctionProposal(m_params.cursorPosition, items, m_params.openInNextSplit); }
static void appendSnippets(QList<AssistProposalItem *> *items, const QString &groupId, const QIcon &icon, int order) { SnippetsCollection *collection = SnippetsCollection::instance(); const int size = collection->totalActiveSnippets(groupId); for (int i = 0; i < size; ++i) { const Snippet &snippet = collection->snippet(i, groupId); AssistProposalItem *item = new AssistProposalItem; item->setText(snippet.trigger() + QLatin1Char(' ') + snippet.complement()); item->setData(snippet.content()); item->setDetail(snippet.generateTip()); item->setIcon(icon); item->setOrder(order); items->append(item); } }
IAssistProposal *perform(const AssistInterface *interface) override { if (!interface) return 0; const QScopedPointer<const AssistInterface> AssistInterface(interface); QIcon icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Core::Constants::ICON_PASTE))).pixmap(16); CircularClipboard * clipboard = CircularClipboard::instance(); QList<AssistProposalItem *> items; for (int i = 0; i < clipboard->size(); ++i) { QSharedPointer<const QMimeData> data = clipboard->next(); AssistProposalItem *item = new ClipboardProposalItem(data); item->setIcon(icon); item->setOrder(clipboard->size() - 1 - i); items.append(item); } return new GenericProposal(interface->position(), items); }