Hi J-P,
It is not working as I try to call the method generateFilterInvokable2()
in the function:
function createBloomFilter() {
getAppState().filterCharged = true;
Bloomfilters.generateFilterInvokable2()
console.log("Called")
}
And as result "Called" is never printed. So I guess that it crashes.
El Miércoles 26 de febrero de 2014 0:30, Sylvain B. <sth...@hotmail.com>
escribió:
No, I am able to invoke c++ methods from QML while having exposed them the
exact same way.
>The only difference would be that my constructor is a simple "Bloomfilters()".
>So same question than J-P: what exactly isn't working?
>
>
>> Date: Tue, 25 Feb 2014 16:31:13 +0100
>> From: mikel...@gmail.com
>> To: antonio.cano.go...@ovi.com; devel@lists.sailfishos.org
>> Subject: Re: [SailfishDevel] QML C++ Integration not working in Sailfish
>>
>> I think you need to add a qRegisterMetatype() to be able to invoke
>> methods from qml.
>>
>> On Tue, Feb 25, 2014 at 3:06 PM, <antonio.cano.go...@ovi.com> wrote:
>> > Hi,
>> >
>> > I am trying to do a simple Sailfish aplication that uses a c++ library. I
>> > try to connect my qml code with the C++ code.
>> >
>> > First I create QObject extended library:
>> >
>> > #ifndef BLOOMFILTERS_H
>> > #define BLOOMFILTERS_H
>> >
>> >
>> > #include <QObject>
>> > #include "svn/bloom-read-only/bloom_filter.hpp"
>> >
>> > class Bloomfilters : public QObject
>> > {
>> > Q_OBJECT
>> >
>> >
>> > public:
>> > Q_INVOKABLE void generateFilterInvokable2() const ;
>> > Q_INVOKABLE void generateFilterInvokable(const QString &cadenaK, const
>> > QString &cadenaM) const ;
>> >
>> >
>> > explicit Bloomfilters(QObject *parent = 0);
>> >
>> > void generateFilter() ;
>> >
>> > Q_INVOKABLE void insertElement(const QString &cadena) ;
>> >
>> > Q_INVOKABLE bool checkElement(const QString &cadena) ;
>> >
>> >
>> >
>> >
>> > signals:
>> >
>> >
>> > public slots:
>> >
>> > private:
>> > bloom_parameters _parameters ;
>> > bloom_filter _filter;
>> > bool _filter_charged;
>> > QString _k;
>> > };
>> >
>> > #endif // BLOOMFILTERS_H
>> >
>> >
>> >
>> > An I try to connect this with my sailfish application with the code:
>> >
>> > QGuiApplication *app = SailfishApp::application(argc, argv);
>> > QQuickView *view = SailfishApp::createView();
>> > Bloomfilters * bloomfilters = new Bloomfilters();
>> > view->rootContext()->setContextProperty("Bloomfilters",
>> > bloomfilters);
>> > view->setSource(SailfishApp::pathTo("qml/bloomfilter.qml"));
>> > view->showFullScreen();
>> > return app->exec();
>> >
>> > But this is not working.
>> >
>> > Someone have any idea about what am I doing wrong?
>> >
>> > Best Regards!
>> >
>> >
>> >
>> > _______________________________________________
>> > SailfishOS.org Devel mailing list
>>
>>
>>
>> --
>> Luciano Montanaro
>>
>> Anyone who is capable of getting themselves made President should on
>> no account be allowed to do the job. -- Douglas Adams
>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>
>
>_______________________________________________
>SailfishOS.org Devel mailing list
>
>
_______________________________________________
SailfishOS.org Devel mailing list