I have several classes in my program, one of them is the main GUI and other is an XML-RPC (from XML-RPC for C/C++) class that have several methods. All thinks goes ok, but when I start the QTimer in the GUI class from the XMLRPC clas it says "QTimer can't be stop/started from other thread". If I put signals and slots does nothing. WTF?
cambiaTimer
::cambiaTimer ( rssani_lite
*rss,
QObject *parent
) : QObject ( parent
),rpc_ani
( rss
) { connect ( this,SIGNAL ( cambiarTimer ( int ) ), rss, SLOT ( cambiaTimer ( int ) ) );
}
void cambiaTimer::execute ( xmlrpc_c::paramList const& paramList,xmlrpc_c::value * const retvalP ) {
emit cambiarTimer ( 1 );
std::cerr << "RPC llamada" << std::endl;
*retvalP = xmlrpc_c::value_int ( 0 ) ;
}
cambiaTimer::cambiaTimer ( rssani_lite *rss, QObject *parent ) : QObject ( parent ),rpc_ani ( rss ) {
connect ( this,SIGNAL ( cambiarTimer ( int ) ), rss, SLOT ( cambiaTimer ( int ) ) );
}
void cambiaTimer::execute ( xmlrpc_c::paramList const& paramList,xmlrpc_c::value * const retvalP ) {
emit cambiarTimer ( 1 );
std::cerr << "RPC llamada" << std::endl;
*retvalP = xmlrpc_c::value_int ( 0 ) ;
}
To copy to clipboard, switch view to plain text mode
void rssani_lite::cambiaTimer(int tiempo) {
qDebug() << "Timer cambiado a : " << tiempo << endl;
this->tiempo = tiempo;
timer.start ( tiempo * 60 * 1000 );
}
void rssani_lite::cambiaTimer(int tiempo) {
qDebug() << "Timer cambiado a : " << tiempo << endl;
this->tiempo = tiempo;
timer.start ( tiempo * 60 * 1000 );
}
To copy to clipboard, switch view to plain text mode
class rssani_lite
: public QObject { Q_OBJECT
public:
rssani_lite
( QObject* parent
= 0);
~rssani_lite();
public slots:
void cambiaTimer(int tiempo);
....
}
class rssani_lite : public QObject {
Q_OBJECT
public:
rssani_lite ( QObject* parent = 0);
~rssani_lite();
public slots:
void cambiaTimer(int tiempo);
....
}
To copy to clipboard, switch view to plain text mode
Thanks in advance.
Bookmarks