File indexing completed on 2024-05-12 04:52:07

0001 /*
0002  * mplayervideowidget.cpp
0003  *
0004  * Copyright (C) 2010-2011 Christoph Pfister <christophpfister@gmail.com>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU General Public License as published by
0008  * the Free Software Foundation; either version 2 of the License, or
0009  * (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License along
0017  * with this program; if not, write to the Free Software Foundation, Inc.,
0018  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0019  */
0020 
0021 #include <QMouseEvent>
0022 
0023 #include "mplayermediawidget.h"
0024 #include "mplayervideowidget.h"
0025 
0026 MPlayerVideoWidget::MPlayerVideoWidget(MPlayerMediaWidget *mediaWidget_) : QWidget(mediaWidget_),
0027     mediaWidget(mediaWidget_)
0028 {
0029     setAttribute(Qt::WA_OpaquePaintEvent);
0030     setAttribute(Qt::WA_PaintOnScreen);
0031     setMouseTracking(true);
0032 }
0033 
0034 MPlayerVideoWidget::~MPlayerVideoWidget()
0035 {
0036 }
0037 
0038 void MPlayerVideoWidget::mouseMoveEvent(QMouseEvent *event)
0039 {
0040     mediaWidget->mouseMoved(event->x(), event->y());
0041     QWidget::mouseMoveEvent(event);
0042 }
0043 
0044 void MPlayerVideoWidget::mousePressEvent(QMouseEvent *event)
0045 {
0046     if (event->button() == Qt::LeftButton) {
0047         mediaWidget->mouseMoved(event->x(), event->y());
0048         mediaWidget->mouseClicked();
0049     }
0050 
0051     QWidget::mousePressEvent(event);
0052 }