当前位置: 首页>>代码示例>>C++>>正文


C++ pageAction函数代码示例

本文整理汇总了C++中pageAction函数的典型用法代码示例。如果您正苦于以下问题:C++ pageAction函数的具体用法?C++ pageAction怎么用?C++ pageAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pageAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: page

void WebView::contextMenuEvent(QContextMenuEvent* event)
{
	if (isLoading_) return;
	QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos());
	QMenu *menu;

	if (!r.linkUrl().isEmpty()) {
		if (r.linkUrl().scheme() == "addnick") {
			event->ignore();
			return;
		}
		menu = URLObject::getInstance()->createPopupMenu(r.linkUrl().toEncoded());
		//menu->addAction(pageAction(QWebPage::CopyLinkToClipboard));
	} else {
		menu = new QMenu(this);
		if (!page()->selectedText().isEmpty()) {
			menu->addAction(pageAction(QWebPage::Copy));
		} else {
			if (!menu->isEmpty()) {
				menu->addSeparator();
			}
			menu->addAction(pageAction(QWebPage::SelectAll));
		}
		if (settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) {
			menu->addAction(pageAction(QWebPage::InspectElement));
		}
	}
	menu->addAction(pageAction(QWebPage::Reload));
	menu->exec(mapToGlobal(event->pos()));
	event->accept();
	delete menu;
}
开发者ID:akatov,项目名称:psi,代码行数:32,代码来源:webview.cpp

示例2: menu

//Page context menu
void AWebView::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu menu(this);
    menu.addAction(pageAction(QWebPage::Back));
    menu.addAction(pageAction(QWebPage::Forward));
    menu.addAction(pageAction(QWebPage::Reload));
    menu.exec(mapToGlobal(event->pos()));
    return;
}
开发者ID:hechaoyuyu,项目名称:SetWallPaper,代码行数:10,代码来源:webview.cpp

示例3: pageAction

void SimplePartWidget::buildContextMenu(const QPoint &point, QMenu &menu) const
{
    menu.addAction(m_findAction);
    auto a = pageAction(QWebPage::Copy);
    a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
    menu.addAction(a);
    a = pageAction(QWebPage::SelectAll);
    a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-select-all")));
    menu.addAction(a);
    if (!page()->mainFrame()->hitTestContent(point).linkUrl().isEmpty()) {
        menu.addSeparator();
        a = pageAction(QWebPage::CopyLinkToClipboard);
        a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
        menu.addAction(a);
    }
    menu.addSeparator();
    menu.addAction(m_savePart);
    menu.addAction(m_saveMessage);
    if (!page()->mainFrame()->hitTestContent(point).imageUrl().isEmpty()) {
        a = pageAction(QWebPage::DownloadImageToDisk);
        a->setIcon(UiUtils::loadIcon(QStringLiteral("download")));
        menu.addAction(a);
    }
    menu.addSeparator();
    QMenu *colorSchemeMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("colorneg")), tr("Color scheme"));
    QActionGroup *ag = new QActionGroup(colorSchemeMenu);
    for (auto item: supportedColorSchemes()) {
        QAction *a = colorSchemeMenu->addAction(item.second);
        connect(a, &QAction::triggered, this, [this, item](){
           const_cast<SimplePartWidget*>(this)->setColorScheme(item.first);
        });
        a->setCheckable(true);
        if (item.first == m_colorScheme) {
            a->setChecked(true);
        }
        a->setActionGroup(ag);
    }

    auto zoomMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("zoom")), tr("Zoom"));
    if (m_messageView) {
        zoomMenu->addAction(m_messageView->m_zoomIn);
        zoomMenu->addAction(m_messageView->m_zoomOut);
        zoomMenu->addAction(m_messageView->m_zoomOriginal);
    } else {
        auto zoomIn = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-in")), tr("Zoom In"));
        zoomIn->setShortcut(QKeySequence::ZoomIn);
        connect(zoomIn, &QAction::triggered, this, &SimplePartWidget::zoomIn);

        auto zoomOut = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-out")), tr("Zoom Out"));
        zoomOut->setShortcut(QKeySequence::ZoomOut);
        connect(zoomOut, &QAction::triggered, this, &SimplePartWidget::zoomOut);

        auto zoomOriginal = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-original")), tr("Original Size"));
        connect(zoomOriginal, &QAction::triggered, this, &SimplePartWidget::zoomOriginal);
    }
}
开发者ID:KDE,项目名称:trojita,代码行数:56,代码来源:SimplePartWidget.cpp

示例4: copyAvailable

void HelpViewer::actionChanged()
{
    QAction *a = qobject_cast<QAction *>(sender());
    if (a == pageAction(QWebPage::Copy))
        emit copyAvailable(a->isEnabled());
    else if (a == pageAction(QWebPage::Back))
        emit backwardAvailable(a->isEnabled());
    else if (a == pageAction(QWebPage::Forward))
        emit forwardAvailable(a->isEnabled());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:10,代码来源:helpviewer.cpp

示例5: backEnabled

void HelpWindowWidget::documentChanged()
{
    // A new help document has been selected, resulting in the previous or next
    // help document becoming either available or not

    QAction *action = qobject_cast<QAction *>(sender());

    if (action == pageAction(QWebPage::Back))
        emit backEnabled(action->isEnabled());
    else if (action == pageAction(QWebPage::Forward))
        emit forwardEnabled(action->isEnabled());
}
开发者ID:fethio,项目名称:opencor,代码行数:12,代码来源:helpwindowwidget.cpp

示例6: menu

void GlaucaWebView::contextMenuEvent(QContextMenuEvent *event){
	QWebHitTestResult result=page()->mainFrame()->hitTestContent(event->pos());
	QMenu menu(this);
	if(result.isContentSelected()){
		menu.addAction(pageAction(QWebPage::Copy));
		menu.addAction("Search \""+this->selectedText()+"\"",this,SIGNAL(searchRequest(this->selectedText())));
		menu.addAction("Add selected items to local wiki",this,SLOT(addSelectedToWiki()));
		menu.addSeparator();
	}
	if(!result.linkUrl().isEmpty()){
		menu.addAction("Open Link in new tab",this,SIGNAL(urlChanged(result.linkUrl())));
		menu.addAction(pageAction(QWebPage::DownloadLinkToDisk));
		menu.addAction(pageAction(QWebPage::CopyLinkToClipboard));
		menu.addSeparator();
	}
	if(!result.imageUrl().isEmpty()){
		menu.addAction(pageAction(QWebPage::CopyImageToClipboard));
		menu.addSeparator();
	}
	menu.addAction(pageAction(QWebPage::Back));
	menu.addAction(pageAction(QWebPage::Forward));
	menu.addAction(pageAction(QWebPage::Reload));
	menu.addAction(pageAction(QWebPage::Stop));
	menu.addSeparator();
	menu.addAction("Add page to local WIKI",this,SLOT(addPageToWiki()));
	menu.addAction("View Page Source",this,SLOT(viewPageSource()));
	menu.exec(mapToGlobal(event->pos()));
}
开发者ID:daiheitan,项目名称:glaucaBrowser,代码行数:28,代码来源:GlaucaWebView.cpp

示例7: contextMenu

void ChannelsView::contextMenu(QMenu *menu, const QWebHitTestResult &result)
{
  menu->addSeparator();

  const QUrl url = result.linkUrl();
  if (url.scheme() == LS("chat") && url.host() == LS("channel"))
    ChannelMenu::bind(menu, ChatUrls::channel(url), IChannelMenu::ChatViewScope);

  menu->addSeparator();

  if (!result.isContentEditable()) {
    menu->removeAction(pageAction(QWebPage::SelectAll));
    menu->addAction(pageAction(QWebPage::SelectAll));
  }
}
开发者ID:Artanomell,项目名称:schat,代码行数:15,代码来源:ChannelsView.cpp

示例8: pageAction

void AWebView::keyPressEvent (QKeyEvent* event)
{
	if (event->matches(QKeySequence::Copy) == true)
		pageAction(QWebPage::Copy)->trigger();
	else
		QWebView::keyPressEvent(event);
}
开发者ID:kan-izh,项目名称:avalon,代码行数:7,代码来源:web_view.cpp

示例9: QWebView

TinyWebBrowser::TinyWebBrowser( QWidget* parent )
    : QWebView( parent ),
      d( 0 )
{
    connect( this, SIGNAL(statusBarMessage(QString)),
             this, SIGNAL(statusMessage(QString)) );

    page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
    connect( this, SIGNAL(linkClicked(QUrl)),
             this, SLOT(openExternalLink(QUrl)) );
    connect( this, SIGNAL(titleChanged(QString)),
             this, SLOT(setWindowTitle(QString)) );

    pageAction( QWebPage::OpenLinkInNewWindow )->setEnabled( false );
    pageAction( QWebPage::OpenLinkInNewWindow )->setVisible( false );
}
开发者ID:calincru,项目名称:marble,代码行数:16,代码来源:TinyWebBrowser.cpp

示例10: pageAction

	void CustomWebView::keyReleaseEvent (QKeyEvent *event)
	{
		bool handled = false;
		if (event->matches (QKeySequence::Copy))
		{
			pageAction (QWebPage::Copy)->trigger ();
			/* TODO
			const QString& text = selectedText ();
			if (!text.isEmpty ())
			{
				QApplication::clipboard ()->setText (text,
						QClipboard::Clipboard);
				handled = true;
			}
			*/
		}
		else if (event->key () == Qt::Key_F6)
			Browser_->focusLineEdit ();
		else if (event->modifiers () == Qt::SHIFT &&
				(event->key () == Qt::Key_PageUp || event->key () == Qt::Key_PageDown))
		{
			ScrollDelta_ += event->key () == Qt::Key_PageUp ? -0.1 : 0.1;
			if (!ScrollTimer_->isActive ())
				ScrollTimer_->start (30);
		}
		else if (event->modifiers () == Qt::SHIFT &&
				event->key () == Qt::Key_Plus)
		{
			ScrollDelta_ = 0;
			ScrollTimer_->stop ();
		}

		if (!handled)
			QGraphicsWebView::keyReleaseEvent (event);
	}
开发者ID:Akon32,项目名称:leechcraft,代码行数:35,代码来源:customwebview.cpp

示例11: QAction

// ------------------------------------------
//  csWebView
// ------------------------------------------
csWebView::csWebView(QWidget *parent)
    :QWebView(parent)
{
    // ------------------------------
    // define additional actions
    // ------------------------------
    sendToClientAct = new QAction(tr("&Send to CGLX"), this);

    // ------------------------------
    // reproduce default context menu
    // for images on the web
    // ------------------------------
    connect(pageAction ( QWebPage::DownloadImageToDisk ),   SIGNAL(triggered()), this, SLOT(DownloadImg()));
    connect(pageAction ( QWebPage::OpenImageInNewWindow ),  SIGNAL(triggered()), this, SLOT(OpenImg()));
    connect(pageAction ( QWebPage::CopyImageToClipboard ),  SIGNAL(triggered()), this, SLOT(CopyImg()));
    connect(sendToClientAct,                                SIGNAL(triggered()), this, SLOT(SendToCGLX()));
}
开发者ID:calit2-kvl,项目名称:vr_connect,代码行数:20,代码来源:main.cpp

示例12: QWebView

HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
    : QWebView(parent)
    , helpEngine(engine)
    , parentWidget(parent)
    , loadFinished(false)
{
    setAcceptDrops(false);

    setPage(new HelpPage(parent, helpEngine, this));

    page()->setNetworkAccessManager(new HelpNetworkAccessManager(engine, this));

    QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
    action->setText(tr("Open Link in New Tab"));
    if (!parent)
        action->setVisible(false);

    pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
    pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
    pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);

    connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
        SLOT(actionChanged()));
    connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
        SLOT(actionChanged()));
    connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
        SLOT(actionChanged()));
    connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
        SIGNAL(highlighted(QString)));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:32,代码来源:helpviewer.cpp

示例13: setPage

void HelpBrowser::setHelpEngine(QHelpEngine* helpEngine)
{
  mpHelpEngine = helpEngine;

  setPage(new HelpPage((QWidget*)parent(), helpEngine, this));

  page()->setNetworkAccessManager(new HelpNetworkAccessManager(helpEngine, this));

  QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
  action->setText(tr("Open Link in New Tab"));
  if (!parent())
    action->setVisible(false);

  pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
  pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
  pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);

}
开发者ID:sbmlteam,项目名称:QtDeviser,代码行数:18,代码来源:helpbrowser.cpp

示例14: pageAction

void lmcMessageLog::createContextMenu(void) {
	QAction* action = pageAction(QWebPage::Copy);
	action->setShortcut(QKeySequence::Copy);
	addAction(action);
	action = pageAction(QWebPage::CopyLinkToClipboard);
	addAction(action);
	action = pageAction(QWebPage::SelectAll);
	action->setShortcut(QKeySequence::SelectAll);
	addAction(action);

	contextMenu = new QMenu(this);
	copyAction = contextMenu->addAction("&Copy", this, SLOT(copyAction_triggered()), QKeySequence::Copy);
	copyLinkAction = contextMenu->addAction("&Copy Link", this, SLOT(copyLinkAction_triggered()));
	contextMenu->addSeparator();
	selectAllAction = contextMenu->addAction("Select &All", this,
							SLOT(selectAllAction_triggered()), QKeySequence::SelectAll);
	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
	setContextMenuPolicy(Qt::CustomContextMenu);
}
开发者ID:j2doll,项目名称:lmc-clone,代码行数:19,代码来源:messagelog.cpp

示例15: QT_VERSION_CHECK

void WebView::contextMenuEvent(QContextMenuEvent* event)
{
	if (isLoading_) return;
#ifdef WEBENGINE
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
	QWebEngineContextMenuData r = page()->contextMenuData();
#else
	struct CMData {
		QUrl linkUrl() { return QUrl(); } // just a stub. TODO invent something
	};
	CMData r;
#endif
#else
	QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos());
#endif
	QMenu *menu;

	if (!r.linkUrl().isEmpty()) {
		if (r.linkUrl().scheme() == "addnick") {
			event->ignore();
			return;
		}
		menu = URLObject::getInstance()->createPopupMenu(r.linkUrl().toEncoded());
		//menu->addAction(pageAction(QWebPage::CopyLinkToClipboard));
	} else {
		menu = new QMenu(this);
		if (!page()->selectedText().isEmpty()) {
#ifdef WEBENGINE
			menu->addAction(pageAction(QWebEnginePage::Copy));
		} else {
			if (!menu->isEmpty()) {
				menu->addSeparator();
			}
			menu->addAction(pageAction(QWebEnginePage::SelectAll));
		}
		menu->addAction(pageAction(QWebEnginePage::InspectElement));
	}
	menu->addAction(pageAction(QWebEnginePage::Reload));
#else
			menu->addAction(pageAction(QWebPage::Copy));
		} else {
开发者ID:lyn1337,项目名称:PsiStorm,代码行数:41,代码来源:webview.cpp


注:本文中的pageAction函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。