QtMvvm icon indicating copy to clipboard operation
QtMvvm copied to clipboard

Does QtMvvm support image object binding ?

Open mangoeffect opened this issue 5 years ago • 1 comments

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;
};

mangoeffect avatar May 27 '20 09:05 mangoeffect

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.

Skycoder42 avatar Jun 07 '20 18:06 Skycoder42