QtMvvm
QtMvvm copied to clipboard
Does QtMvvm support image object binding ?
such like
//data
class ImageData
{
Q_GADGET
Q_PROPERTY(QString key MEMBER key USER true)
public:
QImage img;
};
`
`//ViewModel
class SampleViewModel : public QtMvvm::ViewModel
{
Q_OBJECT
Q_PROPERTY(QtDataSync::DataStoreModel* model READ model CONSTANT)
public:
Q_INVOKABLE explicit SampleViewModel(QObject *parent = nullptr);
QtDataSync::DataStoreModel* model() const;
public Q_SLOTS:
void addData(const QImage &key);
void removeAt(int index);
void showSyncInfo();
private:
QtDataSync::DataStoreModel *_model;
};
Kindof. In widgets, it is no problem at all. In QML, you cannot directly pass QImage objects, but you can workaround this problem by using a QQuickImageProvider.