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

Make QPointer convertable

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.6.0
    • None
    • Core: Object Model
    • None
    • 5
    • 5f28d367d (dev), d026fad3d (dev)
    • Foundations Sprint 79, Foundations Sprint 80, Foundation Sprint 81, Foundation Sprint 82

    Description

      static_assert(std::is_convertible_v<QPointer<QWidget>, QPointer<QObject>>, "is not covertable"); 
      

      raises an error.

      After adding:

      template<typename Up, typename = std::enable_if_t<std::is_convertible_v<Up *, T *>>>
      QPointer(const QPointer<Up> &p) noexcept
          : QPointer{p.data()}
      {}
      

      the code passes.

      It would be quite handy if QPointer could be convertable.

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            bubke Marco Bubke
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes