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


C++ QWebHitTestResult::isContentSelected方法代码示例

本文整理汇总了C++中QWebHitTestResult::isContentSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebHitTestResult::isContentSelected方法的具体用法?C++ QWebHitTestResult::isContentSelected怎么用?C++ QWebHitTestResult::isContentSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWebHitTestResult的用法示例。


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

示例1: onContextMenuRequest

void HelpBrowser::onContextMenuRequest( const QPoint & pos )
{
    QMenu menu;

    QWebHitTestResult hitTest = mWebView->page()->mainFrame()->hitTestContent( pos );

    if (!hitTest.linkElement().isNull()) {
        menu.addAction( mWebView->pageAction(QWebPage::CopyLinkToClipboard) );
    }

    menu.addSeparator();

    if (hitTest.isContentEditable() || hitTest.isContentSelected())
        menu.addAction( mWebView->pageAction(QWebPage::Copy) );
    if (hitTest.isContentEditable())
        menu.addAction( mWebView->pageAction(QWebPage::Paste) );
    if (hitTest.isContentSelected())
        menu.addAction( mActions[Evaluate] );

    menu.addSeparator();

    menu.addAction( mWebView->pageAction(QWebPage::Back) );
    menu.addAction( mWebView->pageAction(QWebPage::Forward) );
    menu.addAction( mWebView->pageAction(QWebPage::Reload) );

    menu.addSeparator();

    menu.addAction( mActions[ZoomIn] );
    menu.addAction( mActions[ZoomOut] );
    menu.addAction( mActions[ResetZoom] );

    menu.exec( mWebView->mapToGlobal(pos) );
}
开发者ID:DSastre,项目名称:supercollider,代码行数:33,代码来源:help_browser.cpp

示例2: contextMenuEvent

void WebView::contextMenuEvent ( QContextMenuEvent * event )
{
    QMenu menu;

    QPoint pos = event->pos();

    QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent( pos );

    if (!hitTest.linkElement().isNull()) {
        menu.addAction( pageAction(QWebPage::CopyLinkToClipboard) );
        menu.addSeparator();
    }

    if (hitTest.isContentEditable() || hitTest.isContentSelected()) {
        menu.addAction( pageAction(QWebPage::Copy) );
        if (hitTest.isContentEditable())
            menu.addAction( pageAction(QWebPage::Paste) );
        menu.addSeparator();
    }

    menu.addAction( pageAction(QWebPage::Back) );
    menu.addAction( pageAction(QWebPage::Forward) );
    menu.addAction( pageAction(QWebPage::Reload) );

    menu.exec( event->globalPos() );
}
开发者ID:DSastre,项目名称:supercollider,代码行数:26,代码来源:QcWebView.cpp

示例3: mousePressEvent

void WebView::mousePressEvent ( QMouseEvent * event )
{
	if (isLoading_) return;
	QWebView::mousePressEvent(event);
	if (event->buttons() & Qt::LeftButton) {
		QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos());
		QSize cs = page()->mainFrame()->contentsSize();
		QSize vs = page()->viewportSize();
		possibleDragging = r.isContentSelected() &&
			QRect(QPoint(0,0),
				  cs - QSize(cs.width()>vs.width()?1:0, cs.height()>vs.height()?1:0) *
					style()->pixelMetric(QStyle::PM_ScrollBarExtent)
				 ).contains(event->pos());
		dragStartPosition = event->pos();
	} else {
		possibleDragging = false;
	}
}
开发者ID:akatov,项目名称:psi,代码行数:18,代码来源:webview.cpp

示例4: editorContextMenuRequested

void MainWindow::editorContextMenuRequested ( const QPoint & pos ) {
    QString guid = getCurrentNoteGuid();
    if (guid == "main")
        return;

    QWebHitTestResult element = ui->editor->page()->mainFrame()->hitTestContent(pos);

    if (element.isNull())
        return;

    QStringList classes = allClasses(element.element());
    if (classes.contains("pdfarea"))
        return;

    QMenu * menu = new QMenu(ui->editor);

    menu->addAction(ui->editor->pageAction(QWebPage::SelectAll));

    if (element.isContentSelected()) {

        if (!menu->isEmpty())
            menu->addSeparator();

        menu->addAction(ui->editor->pageAction(QWebPage::Copy));

        if (element.isContentEditable()) {
            menu->addAction(ui->editor->pageAction(QWebPage::Cut));
            menu->addAction(ui->editor->pageAction(QWebPage::Paste));
            menu->addSeparator();

            menu->addAction(ui->editor->pageAction(QWebPage::ToggleBold));
            menu->addAction(ui->editor->pageAction(QWebPage::ToggleItalic));
            menu->addAction(ui->editor->pageAction(QWebPage::ToggleUnderline));
        }
    }

    if(!element.imageUrl().isEmpty() && (element.imageUrl().scheme() != "qrc")) {

        if (!menu->isEmpty())
            menu->addSeparator();

        menu->addAction(ui->editor->pageAction(QWebPage::DownloadImageToDisk));
        menu->addAction(ui->editor->pageAction(QWebPage::CopyImageToClipboard));

        if (element.imageUrl().scheme() == "http" || element.imageUrl().scheme() == "https")
            menu->addAction(ui->editor->pageAction(QWebPage::CopyImageUrlToClipboard));

        QAction * openImage = new QAction(this);
        openImage->setText("Open Image");
        openImage->setObjectName("openImage");
        menu->addAction(openImage);

        if (JS("editMode").toBool()) {
            menu->addSeparator();

            QAction * deleteImage = new QAction(this);
            deleteImage->setText("Delete Image");
            deleteImage->setObjectName("deleteImage");
            deleteImage->setIcon(QIcon::fromTheme("edit-delete"));
            menu->addAction(deleteImage);

            if (element.imageUrl().scheme() != "resource") {
                QAction * saveLocally = new QAction(this);
                saveLocally->setText("Save Locally");
                saveLocally->setObjectName("saveLocally");
                menu->addAction(saveLocally);
            }
        }
    }

    if (!element.linkUrl().isEmpty()) {
        if (!menu->isEmpty())
            menu->addSeparator();

        menu->addAction(ui->editor->pageAction(QWebPage::CopyLinkToClipboard));

        if (element.isContentEditable()) {
            QAction * deleteURL = new QAction(this);
            deleteURL->setText("Remove Link");
            deleteURL->setObjectName("deleteURL");
            menu->addAction(deleteURL);
        }
    }

    if (element.isContentEditable() && !element.isContentSelected() && element.imageUrl().isEmpty()) {
        Speller *speller = Speller::GetInstance();
        if (speller->initialized()) {

            QHash<QString, QString> languages = speller->availableLanguages();
            if (!languages.isEmpty()) {

                if (!menu->isEmpty())
                    menu->addSeparator();                

                QAction* act = menu->addAction(tr("Check &Spelling"));
                act->setCheckable(true);
                act->setChecked(speller->isEnabled());
                connect(act, SIGNAL(triggered(bool)), speller, SLOT(setEnabled(bool)));

                if (speller->isEnabled()) {
//.........这里部分代码省略.........
开发者ID:MidoriYakumo,项目名称:hippo,代码行数:101,代码来源:mainwindow.cpp


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