Answer the question
In order to leave comments, you need to log in
How to connect a signal with "unknown" arguments to a slot in Qt?
How can you connect an "unknown" signal to a slot that accepts all parameters - QVariant ?
There is such a function:
void createConnection(QWidget *sender, char *signal, zval *receiver, char *slot) {
/*
* тут я заношу в массив отправителя сигнала,
* сигнатуру сигнала,
* обработчика сигнала
* и сигнатуру слота, чтобы потом обращаться к ним
*/
// дальше мне нужно законнектить сигнал со слотом
// сначала у меня было так:
connect(sender, signal, this, SLOT(phpslot()));
}
public slots:
void phpslot(const QVariant &v0 = NULL,
const QVariant &v1 = NULL,
const QVariant &v2 = NULL,
const QVariant &v3 = NULL,
const QVariant &v4 = NULL,
const QVariant &v5 = NULL,
const QVariant &v6 = NULL,
const QVariant &v7 = NULL,
const QVariant &v8 = NULL,
const QVariant &v9 = NULL) {
/* ... */
}
void createConnection(QWidget *sender, char *signal, zval *receiver, char *slot) {
/*
*/
QString sslot = QString(slot);
QString phpqt_slot = "1phpslot" + sslot.mid(sslot.indexOf("("), sslot.indexOf(")")); // типа создаю сигнатуру функции php_slot()
// например, если слот пришел таким: "1update(int, int, int)", то он тупо превратится в "1phpslot(int, int, int)"
connect(sender, signal, this, php_slot);
}
QObject::connect: No such slot ::phpslot(bool)
connect(sender, signal, this, SLOT(phpslot(QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant)));
QObject::connect: Incompatible sender/receiver arguments
connect(sender, signal, this, &phpslot);
ошибка: no matching function for call to 'Phpqt5::connect(PQWidget*&, char*&, Phpqt5*, void (Phpqt5::*)(const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&, const QVariant&))'
connect(sender, signal, this, &phpslot);
Answer the question
In order to leave comments, you need to log in
Look in the direction of the Qt meta system, in particular QMetaMethod (how to connect, how to get a list of parameters, etc.).
And of course, the main question: what problem are you trying to solve in this way? It might not be exactly what you need.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question