Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Assigning a value to a QScopedPointer<QString>?



  • Hello, hope everyone is well. Got a pickle of an error here, any tips would be appreciated. Been googling for over an hour and no luck so far. Is it possible to assign a value to a variable wrapped in a QScopedPointer? Error I get is "no operator = matches these operands"
    Thanks

    TestCode.cpp
    
    QScopedPointer<QString> customerString;
    QString newString01 = "Valued Customer";
    existingString = newString01; // error line
    


  • @Calicoder

    I can't say what type existingString is, but you can't assign a QString value to a QScopedPointer.

    As stated here, QScopedPointer does not have any = operator or copy c'tor.


  • Lifetime Qt Champion

    But the real question here is - why do you want to use QScopedPointer<QString> in the first place?


Log in to reply