Hi.
I would like to measure time beetwen two, or more, events. I wanted somethink like this:
- enter on button1 (IRButton1)--> start time
- enter on button2 (RFidButton) --> stop time
- do somethink depending on difference start and stop time.
In event filter timer starts:
...
if ((object
== IRButton1
) && ev
->type
() == QEvent::Enter) {
...
timer1->start(1000);
...
}
...
if ((object == IRButton1) && ev->type() == QEvent::Enter)
{
...
timer1->start(1000);
...
}
To copy to clipboard, switch view to plain text mode
And stops.
if ((object
== RFidButton
) && ev
->type
() == QEvent::Enter) {
...
timer1->stop();
...
}
...
if ((object == RFidButton) && ev->type() == QEvent::Enter)
{
...
timer1->stop();
...
}
...
To copy to clipboard, switch view to plain text mode
I call also:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
...
connect(timer1,SIGNAL(timeout()),this,SLOT(updateRFiD()));
...
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
...
connect(timer1,SIGNAL(timeout()),this,SLOT(updateRFiD()));
...
To copy to clipboard, switch view to plain text mode
I try with
int MainWindow::updateRFiD()
{
return 1;
}
...
if (updateRFiD()) secs++;
int MainWindow::updateRFiD()
{
return 1;
}
...
if (updateRFiD()) secs++;
To copy to clipboard, switch view to plain text mode
But it doesn't working and now i don't know what do next.
Added after 26 minutes:
I do it in different way i wanted to do 
Just call QTime::currentTime().second() in both event filter (in button1 and button2) and subtracted them. In that way i get different in seconds.
Bookmarks