예제 #1
0
void WebView::zoomIn()
{
    if (m_currentZoomLevel < zoomLevels().count() - 1) {
        m_currentZoomLevel++;
        applyZoom();
    }
}
예제 #2
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_page(0)
    , m_actionReload(0)
    , m_actionStop(0)
    , m_actionsInitialized(false)
    , m_disableTouchMocking(false)
    , m_isReloading(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));

    m_zoomLevels = zoomLevels();
    m_currentZoomLevel = m_zoomLevels.indexOf(100);

    installEventFilter(this);

#ifdef Q_OS_MAC
    new MacWebViewScroller(this);
#endif
}
예제 #3
0
WebView::WebView(QWidget* parent)
    : QWebEngineView(parent)
    , m_siteIconLoader(0)
    , m_progress(100)
    , m_page(0)
    , m_firstLoad(false)
    , m_rwhvqt(0)
{
    connect(this, &QWebEngineView::loadStarted, this, &WebView::slotLoadStarted);
    connect(this, &QWebEngineView::loadProgress, this, &WebView::slotLoadProgress);
    connect(this, &QWebEngineView::loadFinished, this, &WebView::slotLoadFinished);
    connect(this, &QWebEngineView::urlChanged, this, &WebView::slotUrlChanged);
    connect(this, &QWebEngineView::iconUrlChanged, this, &WebView::slotIconUrlChanged);

    m_currentZoomLevel = zoomLevels().indexOf(100);

    setAcceptDrops(true);
    installEventFilter(this);

    WebInspector::registerView(this);
}
예제 #4
0
void WebView::applyZoom()
{
    setZoomFactor(qreal(zoomLevels().at(m_currentZoomLevel)) / 100.0);

    emit zoomLevelChanged(m_currentZoomLevel);
}