diff options
Diffstat (limited to 'ftnoir_tracker_ht')
-rw-r--r-- | ftnoir_tracker_ht/video_widget.cpp | 9 | ||||
-rw-r--r-- | ftnoir_tracker_ht/video_widget.h | 10 |
2 files changed, 9 insertions, 10 deletions
diff --git a/ftnoir_tracker_ht/video_widget.cpp b/ftnoir_tracker_ht/video_widget.cpp index 01f2516a..1504822d 100644 --- a/ftnoir_tracker_ht/video_widget.cpp +++ b/ftnoir_tracker_ht/video_widget.cpp @@ -14,13 +14,10 @@ using namespace std; void VideoWidget::update_image(unsigned char *frame, int width, int height) { QMutexLocker((QMutex*)&mtx); - QImage qframe = QImage(frame, width, height, 3 * width, QImage::Format_RGB888).rgbSwapped().mirrored(); + QImage qframe = QImage(frame, width, height, 3 * width, QImage::Format_RGB888).rgbSwapped(); if (qframe.size() == size() || (qframe.width() <= this->width() && qframe.height() <= this->height())) - qframe = qframe.mirrored(); + qframe = qframe; else - qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation).mirrored(); - QPainter painter(&qframe); - painter.setPen(Qt::blue); - painter.setBrush(Qt::blue); + qframe = qframe.scaled(size(), Qt::IgnoreAspectRatio, Qt::FastTransformation); pixmap = QPixmap::fromImage(qframe); } diff --git a/ftnoir_tracker_ht/video_widget.h b/ftnoir_tracker_ht/video_widget.h index 51acc35e..9d8ab489 100644 --- a/ftnoir_tracker_ht/video_widget.h +++ b/ftnoir_tracker_ht/video_widget.h @@ -15,20 +15,22 @@ #include <QMutexLocker> #include <QLabel> #include <QPainter> +#include <QPaintEvent> // ---------------------------------------------------------------------------- -class VideoWidget : public QLabel +class VideoWidget : public QWidget { Q_OBJECT public: - VideoWidget(QWidget *parent) : QLabel(parent), mtx() { + VideoWidget(QWidget *parent) : QWidget(parent), mtx() { } void update_image(unsigned char* frame, int width, int height); protected slots: void paintEvent( QPaintEvent* e ) { - setPixmap(pixmap); - QLabel::paintEvent(e); + QMutexLocker((QMutex*)&mtx); + QPainter painter(this); + painter.drawPixmap(e->rect(), pixmap); } private: QMutex mtx; |