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

QDataWidgetMapper does not work with non-editable fields such as QLabel.

XMLWordPrintable

      The documentation for QDataWidgetMapper indicates that any display field can be mapped to a type of QAbstractItemModel. However, this is not the case.

      In my testing, only editable fields display data. This was brought to my attention when none of the fields I'd mapped were being set. I think traced execution and saw that the only Qt::DisplayRole that the mapper was calling was Qt::EditRole.

      To simplify things, I referred to the Qt provided examples for the QDataWidgetMapper. I changed the LineEdit pointers to QLabel pointers and saw the same behavior.

      Example Project: simplewidgetmapper
      Source URL: http://doc.trolltech.com/qq/qq21-datawidgetmapper.html

      By changing the type of widget being mapped to, the project breaks.

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

            docteam Qt Documentation Team
            jkyle James A Kyle
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes