Hey, I'm plotting GPS coordinates into a graph. However, I want to make, when a point is pressed, a label, which is initially hidden, appear, showing other information I need. How can I do it? I've been reading about mouse-pressed events, but I couldn't find a solution.
Here is my code

```
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QFile>
#include <QMessageBox>
#include "dms.h"
#include <QDebug>
#include <QPen>
#include <iostream>

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}

MainWindow::~MainWindow()
{
delete ui;
}


void MainWindow::on_pushButton_clicked()
{
QString linha,latitude,longitude,direcao1,direcao2,tempo;
QStringList list,aux;
QVector<double> lati,longi,time;
QString lineNames;
QPen pen;
float constante;
constante=0;

lineNames="lsNone";

QFile file(QFileDialog::getOpenFileName(this,tr("Open File"),"",tr("Text Files (*.txt)"))); // escolha do ficheiro no pc do utilizador

if(!file.open(QIODevice::ReadOnly)) //abertura do ficheiro em seguran├ža no modo read
QMessageBox::information(0,"info",file.errorString());

QTextStream in(&file);

while(!in.atEnd())
{
linha=in.readLine();

list=linha.split(",");
tempo=list[1];
time.append(ajustatempos(tempo,&constante)),
latitude=list[2];
direcao1=list[3];
lati.append(nmea_para_graus(latitude,direcao1));
longitude=list[4];
direcao2=list[5];

longi.append(nmea_para_graus(longitude,direcao2));

}
QVector<double> x,y;
QVector<double> z,r,w;
int i;
int volta=0;
ui->widget->addGraph();
for(i=3300;i<10000;i++)
{
x.append(lati);
y.append(longi);
z.append(abs(lati-38.74910));
r.append(abs(longi+9.3925));
w.append(z[i-3300]+r[i-3300]);
// add the text label at the top:
QCPItemText *textLabel = new QCPItemText(ui->widget);
textLabel->setPositionAlignment(Qt::AlignTop|Qt::AlignHCenter);
textLabel->position->setType(QCPItemPosition::ptAxisRectRatio);
textLabel->position->setCoords(0.5,0.7); // place position
textLabel->setText(QString::number(time));
textLabel->setFont(QFont(font().family(), 7)); // make font a bit larger
textLabel->setPen(QPen(Qt::black));// show black border around text

// add the arrow:
QCPItemLine *arrow = new QCPItemLine(ui->widget);
arrow->start->setParentAnchor(textLabel->bottom);
arrow->end->setCoords(x[i-3300],y[i-3300]); // point in x-y-plot coordinates
arrow->setHead(QCPLineEnding::esSpikeArrow);
textLabel->setVisible(false);
arrow->setVisible(false);

if(w[i-3300]<0.00055 && i>3302 && w[i-3301]>0.00055)
{
break;
}

}


ui->widget->graph(0)->setData(x,y);
// give the axes some labels:
ui->widget->xAxis->setLabel("x");
ui->widget->yAxis->setLabel("y");
pen.setColor(QColor(qSin(1.2)*80+80,80+80, qSin(1.5)*80+80));
ui->widget->graph()->setPen(pen);
ui->widget->graph()->setLineStyle((QCPGraph::LineStyle)QCPGraph::lsNone);
ui->widget->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 5));


// set axes ranges, so we see all data:
ui->widget->xAxis->setRange(36, 38);
ui->widget->yAxis->setRange(-7, -9);
ui->widget->setInteraction(QCP::iRangeZoom, true);
ui->widget->replot();
}
```