'I am currently having an issue tryinh to compile this program. The program is supposed to show the coordinates of the mouse on a GUI QWidget The error is in line 6 of the mainwindow.cpp file'
//header
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QApplication>
#include <QMainWindow>
#include <QMouseEvent>
#include <QMessageBox>
#include <QWidget>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
void mouseReleaseEvent(QMouseEvent * event);
~MainWindow();
private:
Ui::MainWindow *ui;
QMessageBox *msgBox;
};
#endif // MAINWINDOW_H
' mainwindow.cpp file'
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow()
{
MainWindow::mouseReleaseEvent (QMouseEvent * event);
}
void MainWindow::mouseReleaseEvent(QMouseEvent * event)
{
msgBox = new QMessageBox();
msgBox -> setWindowTitle("Coordinates");
msgBox -> setText("You released the button");
msgBox -> show();
}
MainWindow::~MainWindow()
{
delete ui;
}
'main.cpp'
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow *w = new MainWindow();
w->setWindowTitle(QString::fromUtf8("QT-capture mouse release"));
w->resize(300, 250);
w->show();
return a.exec();
}
Please help, I know it is something related to pointers and possibly mutators, but I can't see it yet. Thank you.