本文整理汇总了C++中QWebHitTestResult::linkText方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebHitTestResult::linkText方法的具体用法?C++ QWebHitTestResult::linkText怎么用?C++ QWebHitTestResult::linkText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebHitTestResult
的用法示例。
在下文中一共展示了QWebHitTestResult::linkText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextMenuEvent
void CustomWebView::contextMenuEvent (QGraphicsSceneContextMenuEvent *e)
{
QPointer<QMenu> menu (new QMenu ());
QWebHitTestResult r = page ()->
mainFrame ()->hitTestContent (e->pos ().toPoint ());
IHookProxy_ptr proxy (new Util::DefaultHookProxy ());
emit hookWebViewContextMenu (proxy, this, e, r,
menu, WVSStart);
if (!r.linkUrl ().isEmpty ())
{
QUrl url = r.linkUrl ();
QString text = r.linkText ();
if (XmlSettingsManager::Instance ()->
property ("TryToDetectRSSLinks").toBool ())
{
bool hasAtom = text.contains ("Atom");
bool hasRSS = text.contains ("RSS");
if (hasAtom || hasRSS)
{
LeechCraft::Entity e;
if (hasAtom)
{
e.Additional_ ["UserVisibleName"] = "Atom";
e.Mime_ = "application/atom+xml";
}
else
{
e.Additional_ ["UserVisibleName"] = "RSS";
e.Mime_ = "application/rss+xml";
}
e.Entity_ = url;
e.Parameters_ = LeechCraft::FromUserInitiated |
LeechCraft::OnlyHandle;
bool ch = false;
emit couldHandle (e, &ch);
if (ch)
{
QList<QVariant> datalist;
datalist << url
<< e.Mime_;
menu->addAction (tr ("Subscribe"),
this,
SLOT (subscribeToLink ()))->setData (datalist);
menu->addSeparator ();
}
}
}
menu->addAction (tr ("Open &here"),
this, SLOT (openLinkHere ()))->setData (url);
menu->addAction (tr ("Open in new &tab"),
this, SLOT (openLinkInNewTab ()))->setData (url);
menu->addSeparator ();
menu->addAction (tr ("&Save link..."),
this, SLOT (saveLink ()));
QList<QVariant> datalist;
datalist << url
<< text;
menu->addAction (tr ("&Bookmark link..."),
this, SLOT (bookmarkLink ()))->setData (datalist);
menu->addSeparator ();
if (!page ()->selectedText ().isEmpty ())
menu->addAction (pageAction (QWebPage::Copy));
menu->addAction (tr ("&Copy link"),
this, SLOT (copyLink ()));
if (page ()->settings ()->testAttribute (QWebSettings::DeveloperExtrasEnabled))
menu->addAction (pageAction (QWebPage::InspectElement));
}
else if (page ()->selectedText ().contains (UrlInText))
{
menu->addAction (tr ("Open as link"),
this, SLOT (openLinkInNewTab ()))->
setData (page ()->selectedText ());
}
emit hookWebViewContextMenu (proxy, this, e, r,
menu, WVSAfterLink);
if (!r.imageUrl ().isEmpty ())
{
if (!menu->isEmpty ())
menu->addSeparator ();
menu->addAction (tr ("Open image here"),
this, SLOT (openImageHere ()))->setData (r.imageUrl ());
menu->addAction (tr ("Open image in new tab"),
this, SLOT (openImageInNewTab ()));
menu->addSeparator ();
menu->addAction (tr ("Save image..."),
this, SLOT (saveImage ()));
QAction *spx = menu->addAction (tr ("Save pixmap..."),
//.........这里部分代码省略.........