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


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

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


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

示例1: contextMenuEvent

void webview::contextMenuEvent(QContextMenuEvent * event)
{
    QMenu * menu = new QMenu();
    menu->setVisible(true);
    QWebHitTestResult element = this->page()->mainFrame()->hitTestContent(event->pos());
    if(!element.linkUrl().isEmpty())
    {
        QAction * newtab = this->pageAction(QWebPage::OpenLinkInNewWindow);
        newtab->setText(tr("open link in new tab"));
        menu->addAction(newtab);
        menu->addAction(this->pageAction(QWebPage::DownloadLinkToDisk));
        menu->addAction(this->pageAction(QWebPage::CopyLinkToClipboard));
    }
    if(!element.imageUrl().isEmpty())
    {
        menu->addAction(this->pageAction(QWebPage::DownloadImageToDisk));
        menu->addAction(this->pageAction(QWebPage::CopyImageToClipboard));
        menu->addAction(this->pageAction(QWebPage::CopyImageUrlToClipboard));
        QAction * newimage = this->pageAction(QWebPage::OpenImageInNewWindow);
        newimage->setText(tr("open image in new tab"));
        menu->addAction(newimage);
    }
    if(!page()->selectedText().isEmpty())
    {
        menu->addAction(this->pageAction(QWebPage::Copy));
        menu->addAction(this->pageAction(QWebPage::Cut));
        menu->addAction(this->pageAction(QWebPage::Paste));
        menu->addAction(this->pageAction(QWebPage::Undo));
        menu->addAction(this->pageAction(QWebPage::Redo));
        menu->addAction(this->pageAction(QWebPage::SelectAll));
    }
    if(element.element().tagName().toLower() == "input" && element.element().attribute(QLatin1String("type")).toLower() == "text")
    {
        menu->addAction(this->pageAction(QWebPage::SelectAll));
        menu->addAction(this->pageAction(QWebPage::Paste));
        menu->addAction(this->pageAction(QWebPage::SetTextDirectionLeftToRight));
        menu->addAction(this->pageAction(QWebPage::SetTextDirectionRightToLeft));
        menu->addAction(this->pageAction(QWebPage::SetTextDirectionDefault));
        menu->addAction(this->pageAction(QWebPage::MoveToNextWord));
    }
    if(!element.isNull())
    {
        menu->addAction(this->pageAction(QWebPage::Back));
        menu->addAction(this->pageAction(QWebPage::Forward));
        menu->addAction(this->pageAction(QWebPage::Reload));
        menu->addAction(this->pageAction(QWebPage::Stop));
        menu->addAction(this->pageAction(QWebPage::InspectElement));
    }
    menu->exec(event->globalPos());
}
开发者ID:ubuntuphp,项目名称:letssee,代码行数:50,代码来源:webview.cpp

示例2: SendToCGLX

void csWebView::SendToCGLX()
{
    //printf("Hello at x: %d y: %d\n", hit_pos.x(),  hit_pos.y());
    QWebFrame *tframe=page()->currentFrame ();
    QWebHitTestResult	hitresult = tframe->hitTestContent ( hit_pos );
    if(!hitresult.isNull())
    {
        QPixmap img = hitresult.pixmap();
        if(!img.isNull())
        {
            //printf("Width: %d Height: %d Link: %s\n",img.width(), img.height(),hitresult.imageUrl().toString().toStdString().c_str());
            emit send_image(img.width(), img.height() , hitresult.imageUrl());
        }
    }
}
开发者ID:calit2-kvl,项目名称:vr_connect,代码行数:15,代码来源:main.cpp

示例3: PyBool_FromLong

static PyObject *meth_QWebHitTestResult_isNull(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QWebHitTestResult *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QWebHitTestResult, &sipCpp))
        {
            bool sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->isNull();
            Py_END_ALLOW_THREADS

            return PyBool_FromLong(sipRes);
        }
    }
开发者ID:ClydeMojura,项目名称:android-python27,代码行数:18,代码来源:sipQtWebKitQWebHitTestResult.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::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。