Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

QT6 function overloading – QList redefinition of QVector

I have an compilation error "error: redefinition of ‘from_json’" with that code:

#include <QVector>
#include <QList>
#include <QDebug>

template<typename OwnType> void from_json(QVector<OwnType> &p)
{
    qDebug() << "QVector";
}

template<typename OwnType> void from_json(QList<OwnType> &p)
{
    qDebug() << "QList";
}

But i getting that compilation error only in QT6. In QT5 that compilling and working successfully. Whats wrong?

c++17 MinGW

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In Qt6, QVector is just an alias for QList.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading