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. C2027" user of undefined type 'QCursor'
Forum Updated to NodeBB v4.3 + New Features

C2027" user of undefined type 'QCursor'

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 246 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    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;
    }
    

    Kind Regards,
    Sy

    jsulmJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      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;
      }
      
      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @SPlatten

      #include <QCursor>
      

      ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

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