⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qwebpage.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);#endif            editor->copyURL(d->hitTestResult.linkUrl(), d->hitTestResult.linkText());            break;        }        case OpenImageInNewWindow:            openNewWindow(d->hitTestResult.imageUrl(), frame);            break;        case DownloadImageToDisk:            frame->loader()->client()->startDownload(WebCore::ResourceRequest(d->hitTestResult.imageUrl(), frame->loader()->outgoingReferrer()));            break;        case DownloadLinkToDisk:            frame->loader()->client()->startDownload(WebCore::ResourceRequest(d->hitTestResult.linkUrl(), frame->loader()->outgoingReferrer()));            break;#ifndef QT_NO_CLIPBOARD        case CopyImageToClipboard:            QApplication::clipboard()->setPixmap(d->hitTestResult.pixmap());            break;#endif        case Back:            d->page->goBack();            break;        case Forward:            d->page->goForward();            break;        case Stop:            mainFrame()->d->frame->loader()->stopForUserCancel();            break;        case Reload:            mainFrame()->d->frame->loader()->reload();            break;        case SetTextDirectionDefault:            editor->setBaseWritingDirection(NaturalWritingDirection);            break;        case SetTextDirectionLeftToRight:            editor->setBaseWritingDirection(LeftToRightWritingDirection);            break;        case SetTextDirectionRightToLeft:            editor->setBaseWritingDirection(RightToLeftWritingDirection);            break;        case InspectElement:            if (!d->hitTestResult.isNull())                d->page->inspectorController()->inspect(d->hitTestResult.d->innerNonSharedNode.get());            else                d->page->inspectorController()->show();            break;        default:            command = QWebPagePrivate::editorCommandForWebActions(action);            break;    }    if (command)        editor->command(command).execute();}QSize QWebPage::viewportSize() const{    if (d->mainFrame && d->mainFrame->d->frame->view())        return d->mainFrame->d->frame->view()->frameRect().size();    return d->viewportSize;}/*!    \property QWebPage::viewportSize    \brief the size of the viewport    The size affects for example the visibility of scrollbars    if the document is larger than the viewport.    By default, for a newly-created Web page, this property contains a size with    zero width and height.*/void QWebPage::setViewportSize(const QSize &size) const{    d->viewportSize = size;    QWebFrame *frame = mainFrame();    if (frame->d->frame && frame->d->frame->view()) {        WebCore::FrameView* view = frame->d->frame->view();        view->setFrameRect(QRect(QPoint(0, 0), size));        view->forceLayout();        view->adjustViewSize();    }}QSize QWebPage::fixedLayoutSize() const{    if (d->mainFrame && d->mainFrame->d->frame->view())        return d->mainFrame->d->frame->view()->fixedLayoutSize();    return d->fixedLayoutSize;}/*!    \property QWebPage::fixedLayoutSize    \since 4.6    \brief the size of the fixed layout    The size affects the layout of the page in the viewport.  If set to a fixed size of    1024x768 for example then webkit will layout the page as if the viewport were that size    rather than something different.*/void QWebPage::setFixedLayoutSize(const QSize &size) const{    d->fixedLayoutSize = size;    QWebFrame *frame = mainFrame();    if (frame->d->frame && frame->d->frame->view()) {        WebCore::FrameView* view = frame->d->frame->view();        view->setFixedLayoutSize(size);        view->forceLayout();    }}bool QWebPage::useFixedLayout() const{    return d->useFixedLayout;}/*!    \property QWebPage::usedFixedLayout    \since 4.6    \brief whether to use a fixed layout size*/void QWebPage::setUseFixedLayout(bool useFixedLayout){    d->useFixedLayout = useFixedLayout;    QWebFrame *frame = mainFrame();    if (frame->d->frame && frame->d->frame->view()) {        WebCore::FrameView* view = frame->d->frame->view();        view->setUseFixedLayout(useFixedLayout);        view->forceLayout();    }}/*!    \fn bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)    This function is called whenever WebKit requests to navigate \a frame to the resource specified by \a request by means of    the specified navigation type \a type.    If \a frame is a null pointer then navigation to a new window is requested. If the request is    accepted createWindow() will be called.    The default implementation interprets the page's linkDelegationPolicy and emits linkClicked accordingly or returns true    to let QWebPage handle the navigation itself.    \sa createWindow()*/#if QT_VERSION >= 0x040400bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)#elsebool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)#endif{    if (type == NavigationTypeLinkClicked) {        switch (d->linkPolicy) {            case DontDelegateLinks:                return true;            case DelegateExternalLinks:                if (WebCore::FrameLoader::shouldTreatSchemeAsLocal(request.url().scheme()))                    return true;                emit linkClicked(request.url());                return false;            case DelegateAllLinks:                emit linkClicked(request.url());                return false;        }    }    return true;}/*!    \property QWebPage::selectedText    \brief the text currently selected    By default, this property contains an empty string.    \sa selectionChanged()*/QString QWebPage::selectedText() const{    return d->page->focusController()->focusedOrMainFrame()->selectedText();}/*!   Returns a QAction for the specified WebAction \a action.   The action is owned by the QWebPage but you can customize the look by   changing its properties.   QWebPage also takes care of implementing the action, so that upon   triggering the corresponding action is performed on the page.   \sa triggerAction()*/QAction *QWebPage::action(WebAction action) const{    if (action == QWebPage::NoWebAction) return 0;    if (d->actions[action])        return d->actions[action];    QString text;    QIcon icon;    QStyle *style = view() ? view()->style() : qApp->style();    bool checkable = false;    switch (action) {        case OpenLink:            text = contextMenuItemTagOpenLink();            break;        case OpenLinkInNewWindow:            text = contextMenuItemTagOpenLinkInNewWindow();            break;        case OpenFrameInNewWindow:            text = contextMenuItemTagOpenFrameInNewWindow();            break;        case DownloadLinkToDisk:            text = contextMenuItemTagDownloadLinkToDisk();            break;        case CopyLinkToClipboard:            text = contextMenuItemTagCopyLinkToClipboard();            break;        case OpenImageInNewWindow:            text = contextMenuItemTagOpenImageInNewWindow();            break;        case DownloadImageToDisk:            text = contextMenuItemTagDownloadImageToDisk();            break;        case CopyImageToClipboard:            text = contextMenuItemTagCopyImageToClipboard();            break;        case Back:            text = contextMenuItemTagGoBack();#if QT_VERSION >= 0x040400            icon = style->standardIcon(QStyle::SP_ArrowBack);#endif            break;        case Forward:            text = contextMenuItemTagGoForward();#if QT_VERSION >= 0x040400            icon = style->standardIcon(QStyle::SP_ArrowForward);#endif            break;        case Stop:            text = contextMenuItemTagStop();#if QT_VERSION >= 0x040400            icon = style->standardIcon(QStyle::SP_BrowserStop);#endif            break;        case Reload:            text = contextMenuItemTagReload();#if QT_VERSION >= 0x040400            icon = style->standardIcon(QStyle::SP_BrowserReload);#endif            break;        case Cut:            text = contextMenuItemTagCut();            break;        case Copy:            text = contextMenuItemTagCopy();            break;        case Paste:            text = contextMenuItemTagPaste();            break;#ifndef QT_NO_UNDOSTACK        case Undo: {            QAction *a = undoStack()->createUndoAction(d->q);            d->actions[action] = a;            return a;        }        case Redo: {            QAction *a = undoStack()->createRedoAction(d->q);            d->actions[action] = a;            return a;        }#endif // QT_NO_UNDOSTACK        case MoveToNextChar:            text = tr("Move the cursor to the next character");            break;        case MoveToPreviousChar:            text = tr("Move the cursor to the previous character");            break;        case MoveToNextWord:            text = tr("Move the cursor to the next word");            break;        case MoveToPreviousWord:            text = tr("Move the cursor to the previous word");            break;        case MoveToNextLine:            text = tr("Move the cursor to the next line");            break;        case MoveToPreviousLine:            text = tr("Move the cursor to the previous line");            break;        case MoveToStartOfLine:            text = tr("Move the cursor to the start of the line");            break;        case MoveToEndOfLine:            text = tr("Move the cursor to the end of the line");            break;        case MoveToStartOfBlock:            text = tr("Move the cursor to the start of the block");            break;        case MoveToEndOfBlock:            text = tr("Move the cursor to the end of the block");            break;        case MoveToStartOfDocument:            text = tr("Move the cursor to the start of the document");            break;        case MoveToEndOfDocument:            text = tr("Move the cursor to the end of the document");            break;        case SelectAll:            text = tr("Select all");            break;        case SelectNextChar:            text = tr("Select to the next character");            break;        case SelectPreviousChar:            text = tr("Select to the previous character");            break;        case SelectNextWord:            text = tr("Select to the next word");            break;        case SelectPreviousWord:            text = tr("Select to the previous word");            break;        case SelectNextLine:            text = tr("Select to the next line");            break;        case SelectPreviousLine:            text = tr("Select to the previous line");            break;        case SelectStartOfLine:            text = tr("Select to the start of the line");            break;        case SelectEndOfLine:            text = tr("Select to the end of the line");            break;        case SelectStartOfBlock:            text = tr("Select to the start of the block");            break;        case SelectEndOfBlock:            text = tr("Select to the end of the block");            break;        case SelectStartOfDocument:            text = tr("Select to the start of the document");            break;        case SelectEndOfDocument:            text = tr("Select to the end of the document");            break;        case DeleteStartOfWord:            text = tr("Delete to the start of the word");            break;        case DeleteEndOfWord:            text = tr("Delete to the end of the word");            break;        case SetTextDirectionDefault:            text = contextMenuItemTagDefaultDirection();            break;        case SetTextDirectionLeftToRight:            text = contextMenuItemTagLeftToRight();            c

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -