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

C2027" user of undefined type 'QCursor'



  • The class I am working on is part of a migration from Qt 4.8 to Qt 5.8, the class is derived from QQuickItem:

    class QsltCursorShapeArea : public QQuickItem
    

    In one of the class methods:

    Qt::CursorShape QsltCursorShapeArea::cursorShape() const {
        return cursor().shape();
    }
    

    This results in two errors, which I assume are new with due to Qt 5.8 kit.

    C2017: use of undefined type 'QCursor'
    C2228: left of '.shape' must have class/struct/union
    

    There is another error in the same class:

    C2664: 'void QQuickItem::setCursor(const QCursor &)' : cannot convert argument 1 from 'Qt::CursorShape' to 'const QCursor &'
    
    void QsltCursorShapreArea::setCursorShape(Qt::CursorShape cursorShape) {
        if ( m_currentShape == (int)cursorShape) {
            return;
        }
        setCursor(cursorShape);    //<- This is the line highlighted with the error
        emit cursorShapeChanged();
        m_currentShape = cursorShape;
    }

  • Lifetime Qt Champion

    @SPlatten

    #include <QCursor>
    

    ?


  • Lifetime Qt Champion

    @SPlatten

    #include <QCursor>
    

    ?


Log in to reply