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. QCursor: Cannot create bitmap cursor; invalid bitmap(s)
Forum Updated to NodeBB v4.3 + New Features

QCursor: Cannot create bitmap cursor; invalid bitmap(s)

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 3.6k Views
  • 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Do the files actually exist? Please check with QFile::exists() before trying to create a cursor

    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
    2
    • D Delavega77

      I'm trying to change the cursor Image but I got the following error:
      QCursor: Cannot create bitmap cursor; invalid bitmap(s)

      I tried both:
      QCursor(QBitmap("qrc:/cursorTarget.bmp"));
      QCursor(QPixmap("qrc:/cursorTarget.png"));
      Please help me
      Thanks

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #3

      @Delavega77 said in QCursor: Cannot create bitmap cursor; invalid bitmap(s):

      qrc:/cursorTarget.bmp

      Does it exist and contains valid bitmap?
      What does

      qDebug() << QBitmap("qrc:/cursorTarget.bmp").isNul();
      

      return?

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

      D 1 Reply Last reply
      2
      • jsulmJ jsulm

        @Delavega77 said in QCursor: Cannot create bitmap cursor; invalid bitmap(s):

        qrc:/cursorTarget.bmp

        Does it exist and contains valid bitmap?
        What does

        qDebug() << QBitmap("qrc:/cursorTarget.bmp").isNul();
        

        return?

        D Offline
        D Offline
        Delavega77
        wrote on last edited by
        #4

        @jsulm Thank your for your reply.
        Yes the file exists .

        jsulmJ 1 Reply Last reply
        0
        • D Delavega77

          @jsulm Thank your for your reply.
          Yes the file exists .

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #5

          @Delavega77 So, isNull() returns false?

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

          D 1 Reply Last reply
          1
          • jsulmJ jsulm

            @Delavega77 So, isNull() returns false?

            D Offline
            D Offline
            Delavega77
            wrote on last edited by
            #6

            @jsulm file.exists( ) return true;
            qDebug() << QBitmap("qrc:/cursorTarget.bmp").isNull(); return false;
            but when i try to create the cursor i get that error

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #7

              Can you upload the bitmap so we can try out by ourself?

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

              D 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                Can you upload the bitmap so we can try out by ourself?

                D Offline
                D Offline
                Delavega77
                wrote on last edited by
                #8

                @Christian-Ehrlicher it was my fault; now i dont' get any error when creates the cursor but when i set the cursor to a quickItem in c++ i doesn't have any effect.
                QCursor jackpotCursor= QCursor(QPixmap(":/cursorTarget.png"));
                window->setCursor(jackpotCursor);

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Can you try out with a QWidget first, if it works try to create a minimal testcase for a QQuickWhatever

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

                  D 1 Reply Last reply
                  1
                  • Christian EhrlicherC Christian Ehrlicher

                    Can you try out with a QWidget first, if it works try to create a minimal testcase for a QQuickWhatever

                    D Offline
                    D Offline
                    Delavega77
                    wrote on last edited by
                    #10

                    @Christian-Ehrlicher I tried with a QWidget and it works fine...

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Then you should create a small testcase and create a bug report (and post the link here)

                      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
                      0

                      • Login

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