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

QTagWidget::indexOf should take a const QWidget*

    XMLWordPrintable

Details

    • All

    Description

      https://doc.qt.io/qt-5/qtabwidget.html#indexOf
      Should take a const QWidget* or const QWidget& to allow this method to be used from const methods

       

      Consider this example:

      class Edit : QPlainTextEdit
      {
      Q_OBJECT
      public:
         Edit(const QTabWidget& parent) : _parent{parent} {}
         // would like to do: 
         // int myIndex() const { return _parent.indexOf(this)};
      
         // have to do:
         int myIndex() const { return _parent.indexOf(const_cast<Edit*>(this));};
      
      private:
         const QTabWidget& _parent;
      };
      

       

       

      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
            ziv x x
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes