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

Warning "'return' : conversion from 'size_t' to 'int'" while connecting signal wtih std::vector to a lambda function.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.4.0 Alpha
    • 5.3.1
    • Core: Object Model
    • None
    • QtCreator on Windows and MSVC2013
    • ca4b9f624a41aa656e1d336ea48ec50fe53fa17e

    Description

      Steps to reproduce:

      • create a new Qt Application with Widgets in QtCreator
      • add this signal to the MainWidow class (mainwindow.h):
        signals: void sigUS_selectionItemChange(std::vector<int> const&);
      • add this connection in the MainWindow ctor (mainwindow.cpp):
        QObject::connect(this, &MainWindow::sigUS_selectionItemChange,
        [this](std::vector<int> const&) { });
      • Compile the project.

      Suggestion to correct: modify qmetatype.h file like this (note the added "static_cast<int>("...")"):
      template<typename T>
      struct ContainerAPI<QList<T> > : CapabilitiesImpl<QList<T> >
      { static int size(const QList<T> *t)

      { return static_cast<int>(t->size()); } };

      template<typename T>
      struct ContainerAPI<QVector<T> > : CapabilitiesImpl<QVector<T> >
      { static int size(const QVector<T> *t) { return static_cast<int>(t->size()); }

      };

      template<typename T>
      struct ContainerAPI<std::vector<T> > : CapabilitiesImpl<std::vector<T> >
      { static int size(const std::vector<T> *t)

      { return static_cast<int>(t->size()); } };

      template<typename T>
      struct ContainerAPI<std::list<T> > : CapabilitiesImpl<std::list<T> >
      { static int size(const std::list<T> *t) { return static_cast<int>(t->size()); }

      };

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            vgouvernelle Vincent Gouvernelle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes