Exemple #1
0
void QmlContextTab::contextContextMenu(QPoint pos)
{
    auto idx = ui->contextView->indexAt(pos);
    ContextMenuExtension cme;

    if (!cme.discoverSourceLocation(ContextMenuExtension::GoTo,
                                    idx.sibling(idx.row(), 1).data().toUrl()))
        return;

    QMenu contextMenu;
    cme.populateMenu(&contextMenu);
    contextMenu.exec(ui->contextView->viewport()->mapToGlobal(pos));
}
Exemple #2
0
void GammaRay::BindingTab::bindingContextMenu(const QPoint &pos)
{
    const auto index = ui->bindingView->indexAt(pos);
    if (!index.isValid())
        return;

    QMenu menu;
    ContextMenuExtension ext;
    ext.setLocation(ContextMenuExtension::ShowSource,
                    index.data(ObjectModel::DeclarationLocationRole).value<SourceLocation>());
    ext.populateMenu(&menu);

    menu.exec(ui->bindingView->viewport()->mapToGlobal(pos));
}