summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_ht/video_widget.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-27 12:09:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-27 12:09:05 +0200
commite70bef88fdb5ffdf1c2dcf99ac9e22181d18f5ac (patch)
tree07c97a3c2f5059503c83775e10028481da89b7e3 /ftnoir_tracker_ht/video_widget.h
parentc7c3bfc9a1558864b06319918900090c7564c6d2 (diff)
Implement video widgets properly, so they're fast enough
Diffstat (limited to 'ftnoir_tracker_ht/video_widget.h')
-rw-r--r--ftnoir_tracker_ht/video_widget.h10
1 files changed, 6 insertions, 4 deletions
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;