I have a graphics view wrapper defined as MyQGraphicsView::MyQGraphicsView(QWidget *parent) : QGraphicsView(parent)
Within this, I am trying to set a timed GUI update event with QTimers.
public slots:
void colourGUI(std::vector<Item *> &items);
However, when I try to call it, I get an error. Here is how I’m calling it…
// timer...
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(colourGUI(items)));
timer->start(2000);
I get the following error:
Object::connect: No such slot MyQGraphicsView::colourGUI(items)
What gives? Have I set this up wrong?
There are multiple problems with your code. First, you are trying to connect a signal and slot with different signatures.
You would need(1)
instead of:
However this will only work if the Qt metaobject system knows how to marshal this type, but it doesn’t. You either need to register it or use one of the Qt collections, for example
QList. And timer doesn’t have such signal anyway.(1) the SLOT “description” must not contain argument names and must contain the types of the arguments in order to be able to marshal them correctly.