0

I have a C++ class in which I set the image path which will be available only at run time. I want to use my class as a Custom QML component which should be available in designer tab & I can drag that & use in form editor.

1 Answers1

0

You should separate logic from view.
For an starting point, expose your images paths as model into QML and use a ListView with a Rectangle as delegate and assign model to it. Therefore you have a rectangle for each image path.
For more information read this and this one

*Please note that registering QML Component in Qt 5.15+ has been changed.

S.M.Mousavi
  • 5,013
  • 7
  • 44
  • 59
  • Thanks for the suggestion , I am facing issue to see my cpp component in designer, because it is registered in main.cpp while running of the application. But Designer cant see it at designing time. How can I make my Cpp custom component so it will be available in designer? – Anupam Srivastava Nov 24 '20 at 09:16