I'm trying to connect a QObject signal to a lambda slot but using an interface pointer to the object instead of a pointer to the concrete QObject class. But I get this wierd error:
error: no matching function for call to ‘FileSystemModel::connect(model_filesystem::Directory*&, const char*, FileSystemModel::setDirectory(model_filesystem::Directory*)::<lambda()>)’
});
Here are some snippets of my code:
// Interface declaration
namespace model_filesystem {
class Directory {
public:
virtual ~Directory()
virtual QString name() = 0;
Q_SIGNALS:
void changed();
void failure(QString msg);
};
}
Q_DECLARE_INTERFACE(model_filesystem::Directory, "org.moonlightde.panel.model_filesystem.Directory/1.0")
//Implementation
class GVFSDirectory : public QObject, public model_filesystem::Directory {
Q_OBJECT
Q_INTERFACES(model_filesystem::Directory)
public:
GVFSDirectory(const QString &uri);
GVFSDirectory(GFile * gfile);
virtual ~GVFSDirectory();
virtual QString name();
public Q_SLOTS:
void update();
Q_SIGNALS:
void changed();
void failure(QString msg);
// Usage
Directory * directory = new GVFSDirectory("/");
connect(directory, SIGNAL(model_filesystem::Directory::update()), [this] () {
setupModel();
});
Aucun commentaire:
Enregistrer un commentaire