stackedLayout = new QStackedLayout(this);
setLayout(stackedLayout);
setAcceptDrops(true);
+
+ // mouse autohide
+ setMouseTracking(true);
+ mouseTimer = new QTimer(this);
+ mouseTimer->setInterval(5000);
+ mouseTimer->setSingleShot(true);
+ connect(mouseTimer, SIGNAL(timeout()), SLOT(hideMouse()));
}
void VideoAreaWidget::setVideoWidget(QWidget *videoWidget) {
emit rightClicked();
}
+void VideoAreaWidget::mouseMoveEvent(QMouseEvent * /* event */) {
+ // show the normal cursor
+ unsetCursor();
+ // then hide it again after a few seconds
+ mouseTimer->start();
+}
+
+void VideoAreaWidget::hideMouse() {
+ setCursor(QCursor(QBitmap(1,1)));
+}
+
void VideoAreaWidget::dragEnterEvent(QDragEnterEvent *event) {
qDebug() << event->mimeData()->formats();
if (event->mimeData()->hasFormat("application/x-minitube-video")) {
#define VIDEOAREAWIDGET_H
#include <QWidget>
+#include <QTimer>
#include "video.h"
#include "loadingwidget.h"
#include "ListModel.h"
void mousePressEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
+ void mouseMoveEvent (QMouseEvent *event);
+
+private slots:
+ void hideMouse();
private:
QStackedLayout *stackedLayout;
LoadingWidget *loadingWidget;
ListModel *listModel;
+ QTimer *mouseTimer;
};
#endif // VIDEOAREAWIDGET_H