コード例 #1
0
void QGraphicsWebViewPrivate::updateCompositingScrollPosition()
{
    if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) {
        const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition();
        rootGraphicsLayer.data()->setPos(-scrollPosition);
    }
}
コード例 #2
0
void QGraphicsWebViewPrivate::syncLayers()
{
#if USE(ACCELERATED_COMPOSITING)
    if (shouldSync) {
        QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive();
        shouldSync = false;
    }
#endif
}
コード例 #3
0
void tst_QGraphicsWebView::qgraphicswebview()
{
    QGraphicsWebView item;
    item.url();
    item.title();
    item.icon();
    item.zoomFactor();
    item.history();
    item.settings();
    item.page();
    item.setPage(0);
    item.page();
    item.setUrl(QUrl());
    item.setZoomFactor(0);
    item.load(QUrl());
    item.setHtml(QString());
    item.setContent(QByteArray());
    item.isModified();
}
コード例 #4
0
void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer)
{
    if (rootGraphicsLayer) {
        rootGraphicsLayer.data()->setParentItem(0);
        q->scene()->removeItem(rootGraphicsLayer.data());
        QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive();
    }

    rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0;

    if (layer) {
        layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
        layer->setParentItem(q);
        layer->setZValue(RootGraphicsLayerZValue);
        updateCompositingScrollPosition();
    }
    createOrDeleteOverlay();
}
コード例 #5
0
void QGraphicsWebViewPrivate::createOrDeleteOverlay()
{
    bool useOverlay = false;
    if (!resizesToContents) {
#if USE(ACCELERATED_COMPOSITING)
        useOverlay = useOverlay || rootGraphicsLayer;
#endif
#if ENABLE(TILED_BACKING_STORE)
        useOverlay = useOverlay || QWebFramePrivate::core(q->page()->mainFrame())->tiledBackingStore();
#endif
    }
    if (useOverlay == !!overlay)
        return;
    if (useOverlay) {
        overlay = QSharedPointer<QGraphicsWebViewOverlay>(new QGraphicsWebViewOverlay(q));
        overlay->setZValue(OverlayZValue);
    } else
        overlay.clear();
}
コード例 #6
0
ファイル: main.cpp プロジェクト: dmitrys99/pi
/*------------------------------------------------------------------------------
|    main
+-----------------------------------------------------------------------------*/
int main(int argc, char** argv) {
	qputenv("QT_QPA_EGLFS_FORCE888", "1");

	QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
	QApplication a(argc, argv);

	const QStringList args = a.arguments();
	if (args.size() < 2) {
		log_err("Video ID is missing.");
		return 1;
	}

	const QString videoId = args.at(1);
	log_info("Starting playback of video ID %s...", qPrintable(videoId));

	POC_Bridge bridge(videoId);

	QGraphicsWebView* webItem = new QGraphicsWebView;
	webItem->page()->mainFrame()->addToJavaScriptWindowObject("bridge", &bridge);

	QOpenGLWidget* glViewport = new QOpenGLWidget;

	QGraphicsView* view = new QGraphicsView;
	view->setFrameShape(QFrame::NoFrame);

	view->setRenderHints(QPainter::Antialiasing);
	view->setScene(new QGraphicsScene);
	view->setViewport(glViewport);
	view->showFullScreen();

	view->scene()->setBackgroundBrush(QBrush(Qt::red));
	view->scene()->setSceneRect(QRectF(0, 0, 1920, 1080));
	view->scene()->addItem(webItem);

	webItem->setUrl(QUrl("qrc:/player.html"));
	webItem->setMinimumSize(1920, 1080);

	return a.exec();
}