Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-53294

QDataWidgetMapper with QObject

    XMLWordPrintable

Details

    Description

      QDataWidgetMapper can not be used to bind any QGraphicsWidget embedded in a scene because it does not derive from QWidget. The documentation for QGraphicsWidget clearly states the reason why QGraphicsWidget does not inherit from QWidget. However, because QDataWidgetMapper only accepts QWidget mappings, it can not be used to map any widget or graphics item in a scene to a model.

      It would be extremely useful if QDataWidgetMapper could be used to map graphical items in a scene to a model. Rather than adding an override to QDataWidgetMapper that accepts QGraphicsWidget, I would instead suggest that the override accept any QObject. The code would require very little refactoring to let QDataWidgetMapper bind a model to any arbitrary QObject properties.

      Many users have had problems following the MVC pattern with QGraphicsScene, as a simple Google search makes clear:
      https://www.google.com/?gws_rd=ssl#q=qgraphicsscene+model+view
      This solution would solve this problem in a very straight forward way and require a lot less boilerplate from Qt users. The mapping of arbitrary QObject properties would also solve other niche areas of data binding and give classic Qt a much more feasible and robust means of data binding. Currently QML has the best data binding about as powerful as that offered by the .NET Framework.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            RobertBColton Robert B. Colton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes