Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Assigning a value to a QScopedPointer<QString>?
Forum Updated to NodeBB v4.3 + New Features

Assigning a value to a QScopedPointer<QString>?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 305 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Calicoder
    wrote on last edited by
    #1

    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
    
    Pl45m4P 1 Reply Last reply
    0
    • C Calicoder

      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
      
      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @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.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      2
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

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

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved