6

Can I create an object of a class at runtime, by extracting the class name stored in a string?

eg: I want to create and object of class QButton like

QString strClassName = "QButton";
QButton *pBtn = new strClassName();

I want to read an xml file of all the controls and instantiate them at runtime using this way.

jesterjunk
  • 2,342
  • 22
  • 18
mots_g
  • 637
  • 8
  • 27

1 Answers1

8

Maybe you are looking for the functionality provided by QUiLoader?

jesterjunk
  • 2,342
  • 22
  • 18
Greg S
  • 12,333
  • 2
  • 41
  • 48