Question

In the QT4 library QFileSystemWatcher is supposed to emit a "fileChanged" signal when the watched file is changed.

However, under ruby1.8 "fileChanged" is reported as "No such signal". The FileSystemWatcher is clearly there. I can add files to it and read back the files property; it's just that the changed signal doesn't appear to be defined.

FileSystemWatcher is not included in any of the installed examples.

Here's my line of code that attempts to link up the signal:

connect(self, SIGNAL('fileChanged()'), self, SLOT('mywatcher_changed()') )

"self" is a class derived from Qt::FileSystemWatcher.

Is this implemented and if so, how does one use it?

Thanks.

Was it helpful?

Solution

The content of the signal and slot must be the C++ method signature, including types of the arguments. This is why your signal is not found.

Probably, it should be :

connect(self, SIGNAL('fileChanged( QString path )'), 
     self, SLOT('mywatcher_changed( QString path )') )

or

connect(self, SIGNAL('fileChanged( const QString & path )'), 
     self, SLOT('mywatcher_changed( const QString & path )') )

I am not sure which one is correct because I don't remember if you need to include the "const" and the "&" in the signal name.

See for more information: qtruby doc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top