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

Make QPointer convertable

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • Core: Object Model
    • None
    • 2
    • Foundations Sprint 79

    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

        Activity

          People

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

            Dates

              Created:
              Updated: