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. Getting a QIcon from a QCursor
Forum Updated to NodeBB v4.3 + New Features

Getting a QIcon from a QCursor

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 38 Views 2 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.
  • J Offline
    J Offline
    james b-s
    wrote last edited by
    #1

    I have a QCursor and I'm trying to get a QIcon from it.

      const auto cursorShape = Qt::CursorShape::ArrowCursor;
      QCursor cursor(cursorShape);
      const QPixmap pixmap = cursor.pixmap();
      QIcon qIcon(pixmap);
    

    After that, the qIcon seems to contain null and when I try to use it, I don't get an icon.

    Any suggestions?

    Thanks

    Pl45m4P 1 Reply Last reply
    0
    • J james b-s

      I have a QCursor and I'm trying to get a QIcon from it.

        const auto cursorShape = Qt::CursorShape::ArrowCursor;
        QCursor cursor(cursorShape);
        const QPixmap pixmap = cursor.pixmap();
        QIcon qIcon(pixmap);
      

      After that, the qIcon seems to contain null and when I try to use it, I don't get an icon.

      Any suggestions?

      Thanks

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote last edited by
      #2

      @james-b-s

      where and how do you use it?
      Mind the object lifetime


      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
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote last edited by
        #3

        Hi,

        From the documentation: This is only valid if the cursor is a pixmap cursor. which is not the case here.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        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