Hello. 
This is a simplified version of the corresponding header file:
#ifndef QU_H_
#define QU_H_
#include <QObject>
#include <QFileSystemWatcher>
Q_OBJECT
public:
};
#endif /*QU_H_*/
#ifndef QU_H_
#define QU_H_
#include <QObject>
#include <QFileSystemWatcher>
class QU: QObject {
Q_OBJECT
public:
QU(QObject *parent = 0);
static QFileSystemWatcher Watcher;
};
#endif /*QU_H_*/
To copy to clipboard, switch view to plain text mode
And here the source file (QU.cpp):
#include "QU.h"
#include "QU.h"
QFileSystemWatcher QU::Watcher = QFileSystemWatcher();
QU::QU(QObject *parent): QObject(parent) {}
To copy to clipboard, switch view to plain text mode
Well, the initialization of that static member variable is necessary, because otherwise there will be a "undefinied reference to" in the linker.
But I cannot compile the QU.cpp. The error:
QU.cpp: In copy constructor `QFileSystemWatcher::QFileSystemWatcher(const QFileSystemWatcher&)':
../../../../Tools/Qt/4.3.5/include/QtCore/../../src/corelib/kernel/qobject.h:292: error: `QObject::QObject(const QObject&)' is private
QU.cpp:230: error: within this context
What's going on? A static version of a QDir object works fine...
Edit: Well, QDir() is not derived from QObject. Could it be that no QObject could be static because of the signal/slot concept?
Bookmarks