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

Qt 5 to-do's in QItemDelegate and QStyledItemDelegate

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.0.0 Beta 1
    • None
    • Widgets: Itemviews
    • None

      QItemDelegate::setEditorData() contains a couple of Qt 5 to-do comments (and the same code also appears in QStyledItemDelegate::setEditorData()):

      qtbase/src/widgets/itemviews/qitemdelegate.cpp
      void QItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
      {
      #ifdef QT_NO_PROPERTIES
          Q_UNUSED(editor);
          Q_UNUSED(index);
      #else
          Q_D(const QItemDelegate);
          QVariant v = index.data(Qt::EditRole);
          QByteArray n = editor->metaObject()->userProperty().name();
      
          // ### Qt 5: remove
          // A work-around for missing "USER true" in qdatetimeedit.h for
          // QTimeEdit's time property and QDateEdit's date property.
          // It only triggers if the default user property "dateTime" is
          // reported for QTimeEdit and QDateEdit.
          if (n == "dateTime") {
              if (editor->inherits("QTimeEdit"))
                  n = "time";
              else if (editor->inherits("QDateEdit"))
                  n = "date";
          }
      
          // ### Qt 5: give QComboBox a USER property
          if (n.isEmpty() && editor->inherits("QComboBox"))
              n = d->editorFactory()->valuePropertyName(v.userType());
          if (!n.isEmpty()) {
              if (!v.isValid())
                  v = QVariant(editor->property(n).userType(), (const void *)0);
              editor->setProperty(n, v);
          }
      #endif
      

      These comments should be actioned for Qt 5.0.0 (if that can be done without breaking source-compatibility), removed, or changed to Qt 6 to-do's.

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

            stephen.kelly Stephen Kelly (Unused account) (Inactive)
            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 minute
                1m

                  There are no open Gerrit changes