#include <QtGui>
#include "videoarea.h"
VideoArea
::VideoArea(QWidget *parent
) :{
this->setWindowOpacity(1.0);
}
{
if (event->button() == Qt::LeftButton) {
qDebug("Mouse click: X: %d Y: %d", event->x(), event->y());
crossList.
append(QPoint(event
->x
(), event
->y
()));
paintCross();
}
}
void VideoArea::paintCross()
{
update();
}
{
painter.
setPen(QPen(Qt
::red,
1, Qt
::DashDotLine, Qt
::RoundCap));
for (int i = 0; i < crossList.size(); ++i)
{
painter.drawLine(crossList.at(i).x(), crossList.at(i).y()+10, crossList.at(i).x(), crossList.at(i).y()-10);
painter.drawLine(crossList.at(i).x()+10, crossList.at(i).y(), crossList.at(i).x()-10, crossList.at(i).y());
}
}
#include <QtGui>
#include "videoarea.h"
VideoArea::VideoArea(QWidget *parent) :
QWidget(parent)
{
this->setWindowOpacity(1.0);
}
void VideoArea::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
qDebug("Mouse click: X: %d Y: %d", event->x(), event->y());
crossList.append(QPoint(event->x(), event->y()));
paintCross();
}
}
void VideoArea::paintCross()
{
update();
}
void VideoArea::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setPen(QPen(Qt::red, 1, Qt::DashDotLine, Qt::RoundCap));
for (int i = 0; i < crossList.size(); ++i)
{
painter.drawLine(crossList.at(i).x(), crossList.at(i).y()+10, crossList.at(i).x(), crossList.at(i).y()-10);
painter.drawLine(crossList.at(i).x()+10, crossList.at(i).y(), crossList.at(i).x()-10, crossList.at(i).y());
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks