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

📄 qwebview.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*!    \property QWebView::zoomFactor    \since 4.5    \brief the zoom factor for the view*/void QWebView::setZoomFactor(qreal factor){    page()->mainFrame()->setZoomFactor(factor);}qreal QWebView::zoomFactor() const{    return page()->mainFrame()->zoomFactor();}/*!  \property QWebView::textSizeMultiplier  \brief the scaling factor for all text in the frame  \obsolete  Use setZoomFactor instead, in combination with the  ZoomTextOnly attribute in QWebSettings.  \note Setting this property also enables the  ZoomTextOnly attribute in QWebSettings.  By default, this property contains a value of 1.0.*//*!    Sets the value of the multiplier used to scale the text in a Web page to    the \a factor specified.*/void QWebView::setTextSizeMultiplier(qreal factor){    page()->mainFrame()->setTextSizeMultiplier(factor);}/*!    Returns the value of the multiplier used to scale the text in a Web page.*/qreal QWebView::textSizeMultiplier() const{    return page()->mainFrame()->textSizeMultiplier();}/*!    Finds the next occurrence of the string, \a subString, in the page, using    the given \a options. Returns true of \a subString was found and selects    the match visually; otherwise returns false.    \sa selectedText(), selectionChanged()*/bool QWebView::findText(const QString &subString, QWebPage::FindFlags options){    if (d->page)        return d->page->findText(subString, options);    return false;}/*! \reimp*/bool QWebView::event(QEvent *e){    if (d->page) {#ifndef QT_NO_CONTEXTMENU        if (e->type() == QEvent::ContextMenu) {            if (!isEnabled())                return false;            QContextMenuEvent *event = static_cast<QContextMenuEvent *>(e);            if (d->page->swallowContextMenuEvent(event)) {                e->accept();                return true;            }            d->page->updatePositionDependentActions(event->pos());        } else#endif // QT_NO_CONTEXTMENU        if (e->type() == QEvent::ShortcutOverride) {            d->page->event(e);#ifndef QT_NO_CURSOR        } else if (e->type() == static_cast<QEvent::Type>(WebCore::SetCursorEvent::EventType)) {            d->setCursor(static_cast<WebCore::SetCursorEvent*>(e)->cursor());#if QT_VERSION >= 0x040400        } else if (e->type() == QEvent::CursorChange) {            // Okay we might use the WebCore Cursor now.            d->usesWebCoreCursor = d->cursorSetByWebCore;            d->cursorSetByWebCore = false;            // Go back to the WebCore Cursor. QWidget::unsetCursor is appromixated with this            if (!d->usesWebCoreCursor && cursor().shape() == Qt::ArrowCursor) {                d->usesWebCoreCursor = true;                d->setCursor(d->webCoreCursor);            }#endif#endif        } else if (e->type() == QEvent::Leave) {            d->page->event(e);        }    }    return QWidget::event(e);}/*!    Prints the main frame to the given \a printer.    \sa QWebFrame::print(), QPrintPreviewDialog*/void QWebView::print(QPrinter *printer) const{#ifndef QT_NO_PRINTER    page()->mainFrame()->print(printer);#endif}/*!    Convenience slot that stops loading the document.    It is equivalent to    \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 3    \sa reload(), pageAction(), loadFinished()*/void QWebView::stop(){    if (d->page)        d->page->triggerAction(QWebPage::Stop);}/*!    Convenience slot that loads the previous document in the list of documents    built by navigating links. Does nothing if there is no previous document.    It is equivalent to    \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 4    \sa forward(), pageAction()*/void QWebView::back(){    if (d->page)        d->page->triggerAction(QWebPage::Back);}/*!    Convenience slot that loads the next document in the list of documents    built by navigating links. Does nothing if there is no next document.    It is equivalent to    \snippet doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp 5    \sa back(), pageAction()*/void QWebView::forward(){    if (d->page)        d->page->triggerAction(QWebPage::Forward);}/*!    Reloads the current document.    \sa stop(), pageAction(), loadStarted()*/void QWebView::reload(){    if (d->page)        d->page->triggerAction(QWebPage::Reload);}/*! \reimp*/void QWebView::resizeEvent(QResizeEvent *e){    if (d->page)        d->page->setViewportSize(e->size());}/*! \reimp*/void QWebView::paintEvent(QPaintEvent *ev){    if (!d->page)        return;#ifdef QWEBKIT_TIME_RENDERING    QTime time;    time.start();#endif    QWebFrame *frame = d->page->mainFrame();    QPainter p(this);    frame->render(&p, ev->region());#ifdef    QWEBKIT_TIME_RENDERING    int elapsed = time.elapsed();    qDebug()<<"paint event on "<<ev->region()<<", took to render =  "<<elapsed;#endif}/*!    This function is called whenever WebKit wants to create a new window of the given \a type, for example as a result of    a JavaScript request to open a document in a new window.    \sa QWebPage::createWindow()*/QWebView *QWebView::createWindow(QWebPage::WebWindowType type){    Q_UNUSED(type)    return 0;}/*! \reimp*/void QWebView::mouseMoveEvent(QMouseEvent* ev){    if (d->page) {        const bool accepted = ev->isAccepted();        d->page->event(ev);        ev->setAccepted(accepted);    }}/*! \reimp*/void QWebView::mousePressEvent(QMouseEvent* ev){    if (d->page) {        const bool accepted = ev->isAccepted();        d->page->event(ev);        ev->setAccepted(accepted);    }}/*! \reimp*/void QWebView::mouseDoubleClickEvent(QMouseEvent* ev){    if (d->page) {        const bool accepted = ev->isAccepted();        d->page->event(ev);        ev->setAccepted(accepted);    }}/*! \reimp*/void QWebView::mouseReleaseEvent(QMouseEvent* ev){    if (d->page) {        const bool accepted = ev->isAccepted();        d->page->event(ev);        ev->setAccepted(accepted);    }}#ifndef QT_NO_CONTEXTMENU/*! \reimp*/void QWebView::contextMenuEvent(QContextMenuEvent* ev){    if (d->page) {        const bool accepted = ev->isAccepted();        d->page->event(ev);        ev->setAccepted(accepted);    }}#endif // QT_NO_CONTEXTMENU#ifndef QT_NO_WHEELEVENT/*! \reimp*/void QWebView::wheelEvent(QWheelEvent* ev){    if (d->page) {        const bool accepted = ev->isAccepted();        d->page->event(ev);        ev->setAccepted(accepted);    }}#endif // QT_NO_WHEELEVENT/*! \reimp*/void QWebView::keyPressEvent(QKeyEvent* ev){    if (d->page)        d->page->event(ev);    if (!ev->isAccepted())        QWidget::keyPressEvent(ev);}/*! \reimp*/void QWebView::keyReleaseEvent(QKeyEvent* ev){    if (d->page)        d->page->event(ev);    if (!ev->isAccepted())        QWidget::keyReleaseEvent(ev);}/*! \reimp*/void QWebView::focusInEvent(QFocusEvent* ev){    if (d->page)        d->page->event(ev);    else        QWidget::focusInEvent(ev);}/*! \reimp*/void QWebView::focusOutEvent(QFocusEvent* ev){    if (d->page)        d->page->event(ev);    else        QWidget::focusOutEvent(ev);}/*! \reimp*/void QWebView::dragEnterEvent(QDragEnterEvent* ev){#ifndef QT_NO_DRAGANDDROP    if (d->page)        d->page->event(ev);#endif}/*! \reimp*/void QWebView::dragLeaveEvent(QDragLeaveEvent* ev){#ifndef QT_NO_DRAGANDDROP    if (d->page)        d->page->event(ev);#endif}/*! \reimp*/void QWebView::dragMoveEvent(QDragMoveEvent* ev){#ifndef QT_NO_DRAGANDDROP    if (d->page)        d->page->event(ev);#endif}/*! \reimp*/void QWebView::dropEvent(QDropEvent* ev){#ifndef QT_NO_DRAGANDDROP    if (d->page)        d->page->event(ev);#endif}/*! \reimp*/bool QWebView::focusNextPrevChild(bool next){    if (d->page && d->page->focusNextPrevChild(next))        return true;    return QWidget::focusNextPrevChild(next);}/*!\reimp*/QVariant QWebView::inputMethodQuery(Qt::InputMethodQuery property) const{    if (d->page)        return d->page->inputMethodQuery(property);    return QVariant();}/*!\reimp*/void QWebView::inputMethodEvent(QInputMethodEvent *e){    if (d->page)       d->page->event(e);}/*!\reimp*/void QWebView::changeEvent(QEvent *e){    if (d->page && e->type() == QEvent::PaletteChange) {        d->page->setPalette(palette());    }    QWidget::changeEvent(e);}/*!    \fn void QWebView::titleChanged(const QString &title)    This signal is emitted whenever the \a title of the main frame changes.    \sa title()*//*!    \fn void QWebView::urlChanged(const QUrl &url)    This signal is emitted when the \a url of the view changes.    \sa url(), load()*//*!    \fn void QWebView::statusBarMessage(const QString& text)    This signal is emitted when the statusbar \a text is changed by the page.*//*!    \fn void QWebView::iconChanged()    This signal is emitted whenever the icon of the page is loaded or changes.    \sa icon()*//*!    \fn void QWebView::loadStarted()    This signal is emitted when a new load of the page is started.    \sa loadProgress(), loadFinished()*//*!    \fn void QWebView::loadFinished(bool ok)    This signal is emitted when a load of the page is finished.    \a ok will indicate whether the load was successful or any error occurred.    \sa loadStarted()*//*!    \fn void QWebView::selectionChanged()    This signal is emitted whenever the selection changes.    \sa selectedText()*//*!    \fn void QWebView::loadProgress(int progress)    This signal is emitted every time an element in the web page    completes loading and the overall loading progress advances.    This signal tracks the progress of all child frames.    The current value is provided by \a progress and scales from 0 to 100,    which is the default range of QProgressBar.    \sa loadStarted(), loadFinished()*//*!    \fn void QWebView::linkClicked(const QUrl &url)    This signal is emitted whenever the user clicks on a link and the page's linkDelegationPolicy    property is set to delegate the link handling for the specified \a url.    \sa QWebPage::linkDelegationPolicy()*/

⌨️ 快捷键说明

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