GLWidgetRenderer::GLWidgetRenderer(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFlags f): QGLWidget(parent, shareWidget, f),VideoRenderer(*new GLWidgetRendererPrivate()) { DPTR_INIT_PRIVATE(GLWidgetRenderer); DPTR_D(GLWidgetRenderer); setPreferredPixelFormat(VideoFormat::Format_YUV420P); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); /* To rapidly update custom widgets that constantly paint over their entire areas with * opaque content, e.g., video streaming widgets, it is better to set the widget's * Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead associated with repainting the * widget's background */ setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); //default: swap in qpainter dtor. we should swap before QPainter.endNativePainting() setAutoBufferSwap(false); setAutoFillBackground(false); d.painter = new QPainter(); d.filter_context = FilterContext::create(FilterContext::QtPainter); QPainterFilterContext *ctx = static_cast<QPainterFilterContext*>(d.filter_context); ctx->paint_device = this; ctx->painter = d.painter; setOSDFilter(new OSDFilterQPainter()); }
GLWidgetRenderer::GLWidgetRenderer(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFlags f): QGLWidget(parent, shareWidget, f),VideoRenderer(*new GLWidgetRendererPrivate()) { DPTR_INIT_PRIVATE(GLWidgetRenderer); d_func().widget_holder = this; setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); //setAttribute(Qt::WA_OpaquePaintEvent); //setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(false); // makeCurrent(); }
Direct2DRenderer::Direct2DRenderer(QWidget *parent, Qt::WindowFlags f): QWidget(parent, f),VideoRenderer(*new Direct2DRendererPrivate()) { DPTR_INIT_PRIVATE(Direct2DRenderer); d_func().widget_holder = this; setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); //setAttribute(Qt::WA_OpaquePaintEvent); //setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(false); setAttribute(Qt::WA_PaintOnScreen, true); }
Direct2DRenderer::Direct2DRenderer(QWidget *parent, Qt::WindowFlags f): QWidget(parent, f),VideoRenderer(*new Direct2DRendererPrivate()) { DPTR_INIT_PRIVATE(Direct2DRenderer); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); /* To rapidly update custom widgets that constantly paint over their entire areas with * opaque content, e.g., video streaming widgets, it is better to set the widget's * Qt::WA_OpaquePaintEvent, avoiding any unnecessary overhead associated with repainting the * widget's background */ setAttribute(Qt::WA_OpaquePaintEvent); //setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(false); setAttribute(Qt::WA_PaintOnScreen, true); }