1 #include "jpeg_frame_view.h"
3 #include "post_to_main_thread.h"
5 #include <QGraphicsPixmapItem>
10 string filename_for_frame(unsigned stream_idx, int64_t pts);
12 JPEGFrameView::JPEGFrameView(QWidget *parent)
13 : QGraphicsView(parent) {
16 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
17 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
20 void JPEGFrameView::update_frame()
23 post_to_main_thread([this]{
29 void JPEGFrameView::resizeEvent(QResizeEvent *event)
31 fitInView(&item, Qt::KeepAspectRatio);
34 void JPEGFrameView::paintEvent(QPaintEvent *event)
38 item.setPixmap(QPixmap(QString::fromStdString(filename_for_frame(stream_idx, pts))));
39 fitInView(&item, Qt::KeepAspectRatio);
41 QGraphicsView::paintEvent(event);