#include "windows.h"
#include <QColor>
#include <QPainter>
#include <QString>
windows::windows(QWidget *parent)
: QWidget(parent)
{
resize(800,600);
pixmap = QPixmap(100,50);
background = QPixmap("background.bmp");
x = -1;
y = -1;
}
windows::~windows()
{
}
void windows::mouseMoveEvent(QMouseEvent *event){
x = event->x();
y = event->y();
pixmap.fill(QColor(255,255,255,127));
QPainter painter(&pixmap);
painter.setPen(QColor(255,0,0));
painter.drawText(20,40,QString("%1").arg(x) + "," + QString("%1").arg(y));
update();
}
void windows::paintEvent(QPaintEvent *event){
QPainter painter(this);
painter.drawPixmap(0,0,background);
painter.drawPixmap(x,y,pixmap);
}