QMouseEvent
stores an integer value of the mouse position.
However, it has a protect member "s" which stores a float value of the mouse position.
How can I get the float value?
I have tried inheriting the QMouseEvent
, but unfortunately I get this error message all the time.
error: C2511: 'QMouseEventF::QMouseEventF(QWidget *)' : overloaded member function not found in 'QMouseEventF'
This is my header file:
#ifndef QMOUSEEVENTF_H
#define QMOUSEEVENTF_H
#include<QMouseEvent>
class QMouseEventF : QMouseEvent
{
Q_OBJECT
public:
QMouseEventF(QObject* parent = 0);
~QMouseEventF();
qreal GetX();
};
#endif // QMOUSEEVENTF_H
And here is the inherited class:
#include "qmouseeventf.h"
QMouseEventF::QMouseEventF(QWidget *parent ): QMouseEvent(parent)
{
}
QMouseEventF::~QMouseEventF()
{
}
qreal QMouseEventF::GetX()
{
return this->s.rx();
}