Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. binding to reference of type discards qualifiers
Qt 6.12 LTS is out! See what's new in the release blog

binding to reference of type discards qualifiers

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 3.0k 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.
  • M Offline
    M Offline
    marianexyx
    wrote on last edited by
    #1

    I don't know why I have this kind of error. I don't use any of const value. append() gives the same error. Does it have anything to do with the fact that append() require const T &value? I'm pretty sure that something like that worked good for me in the past. What can be wrong here?

    full error msg:
    C:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtCore\qlist.h:-1: In instantiation of 'void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = DobotMove]':
    C:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtCore\qlist.h:584: required from 'void QList<T>::append(const T&) [with T = DobotMove]'
    C:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtCore\qlist.h:386: required from 'QList<T>& QList<T>::operator<<(const T&) [with T = DobotMove]'
    C:\DobotChess\dobot\dobot_queue.cpp:191: required from here
    C:\Qt\Qt5.10.1\5.10.1\mingw53_32\include\QtCore\qlist.h:441: błąd: binding 'const DobotMove' to reference of type 'DobotMove&' discards qualifiers
    else reinterpret_cast<T>(n) = t;
    ^
    C:\DobotChess\dobot\dobot_queue.cpp:1: In file included from dobot\dobot_queue.cpp:1:0:
    C:\DobotChess\dobot\dobot_queue.h:12: note: initializing argument 1 of 'DobotMove& DobotMove::operator=(DobotMove&)'
    struct DobotMove
    ^

    QList<DobotMove> _queuedCmdIDList;
    
    struct DobotMove
    {
        uint64_t ID;
        DOBOT_MOVE_TYPE type;
        Point3D xyz;
    
        DobotMove() :ID(0), type(DM_NONE), xyz(0,0,0) {}
        DobotMove(uint64_t id, DOBOT_MOVE_TYPE MT, Point3D p): ID(id), type(MT), xyz(p) {}
    };
    
    void DobotQueue::addArmMoveToQueue(DOBOT_MOVE_TYPE Type, Point3D point)
    {
        _un64CoreQueuedCmdID += 1;
        DobotMove cmdToQueue(_un64CoreQueuedCmdID, Type, point);
        _queuedCmdIDList << cmdToQueue; //HERE
    }
    

    Also it would be better to have list of pointers to structs, or just list of structs?

    1 Reply Last reply
    0

    • Login

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