Hi,
I am trying to figure out how to extend the QTimer class so I can pass some variables through the timeout signal. Is that even possible? I was think I could like "catch" the normal timeout() emit and then just emit my own signal with some variables I need.
Or is there some other way I am do not know of to pass arguments or at least get the QTimer object from the signal() that comes through?
I have never done this before and pretty confused. Is what below anything similar to what it should be?
Thanks
#include <QTimer>
#include "common.h"
class FileTimer
: public QTimer{
public:
{
dest = dest;
fileName = fileName;
}
uint16 dest;
signals:
void sendTimeout
(uint16 dest,
QString fileName
);
void timeout()
{
emit sendTimeout(dest, fileName);
}
};
#include <QTimer>
#include "common.h"
class FileTimer: public QTimer{
public:
FileTimer(QObject * parent, uint16 dest, QString fileName):
QTimer ( parent )
{
dest = dest;
fileName = fileName;
}
uint16 dest;
QString fileName;
signals:
void sendTimeout(uint16 dest, QString fileName);
void timeout()
{
emit QTimer::timeout();
emit sendTimeout(dest, fileName);
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks