slide_obj.rs working

This commit finally has a working basic slide_obj implemented in Rust!
There are likely still some things that need to be tweaked and
massaged in order for things to translate back and forth from QML to
Rust.

The key was to make the old SlideObject written in C++ to act as a
bridge between QML and Rust. QML can't seem to understand CXX-QT's
QMap_QString_QVariant type as a QVariantMap and thus didn't translate
the Javascript object properly. Having the call first go into a C++
class translated it and then was trivial to pass into Rust.
This commit is contained in:
Chris Cochrun 2023-03-24 11:31:18 -05:00
parent 0936490bee
commit 0caadfc5c8
6 changed files with 55 additions and 17 deletions

View file

@ -60,6 +60,12 @@ bool SlideObject::loop() const
return m_loop;
}
void SlideObject::chngSlide(QVariantMap item, int index, SlideObj *slideObj) {
qDebug() << "Here is the pointer to the slideObj" << slideObj;
qDebug() << "Here is the item" << item;
slideObj->changeSlide(item, index);
}
void SlideObject::changeSlide(QVariantMap item, int index)
{
// QVariantMap serviceItem = serviceItemModel->getItem(item.value("serviceItemId").toInt());

View file

@ -8,6 +8,7 @@
#include <qqml.h>
#include <QObject>
#include <qobject.h>
#include "cxx-qt-gen/slide_obj.cxxqt.h"
class SlideObject : public Slide
{
@ -33,6 +34,7 @@ public:
bool loop() const;
Q_INVOKABLE void changeSlide(QVariantMap item, int index);
Q_INVOKABLE void chngSlide(QVariantMap item, int index, SlideObj *slideObj);
Q_INVOKABLE void play();
Q_INVOKABLE void pause();
Q_INVOKABLE void playPause();