0

I'm working on a game engine and the past week I've been reading Qt docs about MVC in Qt. However, I'm stalling because it's unclear to me how to move forward with Qt MVC classes. I'm not using qmake or .pro files so many tutorials are even more difficult to follow. Regardless, my question is pretty much my title. I have a QFormLayout with QLineEdit widgets which should correspond to a game object's properties like position, rotation etc. I would like it to be similar to the way Unity3D's inspector works. How can I link each QLineEdit to a certain class' field and furthermore how can I more programatically generate a QLineEdit for every field of a class being inspected (maybe through reflection)?

Bennet Leff
  • 376
  • 1
  • 4
  • 18
  • There is no such functionality built-in in Qt but it can be implemented manually. Check out [QtnProperty](https://github.com/lexxmark/QtnProperty) lib. It uses Q_PROPERTY though so you'll have to configure your build system to execute moc. – Pavel Strakhov Jun 04 '16 at 12:21
  • Good point to start: http://stackoverflow.com/questions/1290838/best-qt-widget-to-use-for-properties-window – Dmitry Sazonov Jun 04 '16 at 18:01
  • Thanks I'll look into this. – Bennet Leff Jun 04 '16 at 18:37
  • The documentation on this is pretty weak not to mention it seems to receive little maintenance. Do you know of any tutorials using QtPropertyBrowsers? – Bennet Leff Jun 05 '16 at 23:33
  • I'd take a QMetaObject (like [here](http://stackoverflow.com/a/20459764/4742108)), and make an QAbstractListModel with two columns: name(qstring) and value(qvariant). Then show it via some view. – Velkan Jun 13 '16 at 13:28
  • I've been using the QtPropertyBrowser class but it's been a little difficult. I've managed to get far with it though. – Bennet Leff Jun 13 '16 at 20:54

0 Answers0