0
ストリーム演算子を既存のQtオブジェクトに追加することは可能ですか?私はこの例のコード(QFileSystemWatcher
)でこれをやってみましたが、最後の行はコンパイルされません。 LineUser
サンプルがコンパイルされます。ストリーム演算子をQtオブジェクトに追加する
Documentation for registering stream operators。
error: use of deleted function ‘QFileSystemWatcher::QFileSystemWatcher(const QFileSystemWatcher&)’
return new (where) T(*static_cast<const T*>(t));
note: ‘QFileSystemWatcher::QFileSystemWatcher(const QFileSystemWatcher&)’ is implicitly deleted because the default definition would be ill-formed:
class Q_CORE_EXPORT QFileSystemWatcher : public QObject error: ‘QObject::QObject(const QObject&)’ is private
Q_DISABLE_COPY(QObject)
error: within this context class Q_CORE_EXPORT QFileSystemWatcher : public QObject note: declared here
Q_DISABLE_COPY(QObject)
代わりに 'QFileSystemWatcher *'のストリーム演算子を追加しようとすることを検討してください。 – dtech
QFileSystemWatcher&* myObjのシグネチャはどうなっていますか? – Joelmob