Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Hide mouse pointer
Forum Updated to NodeBB v4.3 + New Features

Hide mouse pointer

Scheduled Pinned Locked Moved Mobile and Embedded
12 Posts 6 Posters 31.2k 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.
  • F Offline
    F Offline
    f.vanalmetelevic.com
    wrote on 12 Jul 2011, 08:00 last edited by
    #1

    Hi,

    On my embedded platform, I have to hide the mouse pointer in my app. To do that, I use @a.setOverrideCursor( QCursor( Qt::BlankCursor ) )@ at the very beginning of my app. It works well, but the cursor only disappears after I touch the screen once. As long as the touch panel is not touched, the mouse pointer remains visible.
    Is there a way to make the pointer disappear without having to touch the panel first ?

    Filip

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 12 Jul 2011, 08:02 last edited by
      #2

      Sounds like your application does not have focus on startup.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        f.vanalmetelevic.com
        wrote on 12 Jul 2011, 08:19 last edited by
        #3

        My main looks like this :

        @int main(int argc, char *argv[])
        {
        QApplication a(argc, argv);

        a.setOverrideCursor( QCursor( Qt::BlankCursor ) );
        
        QPixmap pixmap ("/images/splash.bmp");
        QSplashScreen *splash = new QSplashScreen(pixmap);
        QFont font("FreeSans", 48, QFont::Bold);
        splash->setFont(font);
        splash->show();
        splash->showMessage(QObject::tr("Loading..."), Qt::AlignTop | Qt::AlignHCenter);
        
        StandardTerminal w;
        w.show();
        
        QTimer::singleShot(500, splash, SLOT(close()));
        
        return a.exec();
        

        }@

        I guess it should have focus, no ?

        1 Reply Last reply
        1
        • Z Offline
          Z Offline
          ZapB
          wrote on 12 Jul 2011, 09:44 last edited by
          #4

          Add this to the start of your main() function but after you create the QApplication object:

          @
          #ifdef Q_WS_QWS
          QWSServer::setCursorVisible( false );
          #endif
          @

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • F Offline
            F Offline
            f.vanalmetelevic.com
            wrote on 12 Jul 2011, 10:05 last edited by
            #5

            Ok, that works. Thanks !

            1 Reply Last reply
            0
            • M Offline
              M Offline
              McLion
              wrote on 21 Oct 2012, 14:00 last edited by
              #6

              Sorry for hijacking this old thread, but I have exactly the same problem and the solution posted doe not work for me. I am trying to have this on Qt4.3 on eLinux.
              error: 'QWSServer' has not been declared
              Any ideas?

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on 21 Oct 2012, 14:18 last edited by
                #7

                Are you using QWS? I can't recall when it was introduced. Have you tried adding #include <QWSServer> ?

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  McLion
                  wrote on 21 Oct 2012, 14:37 last edited by
                  #8

                  Thanks a lot for your answer.
                  I start the application with -qws, I have not included QWSServer in my app.

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    ZapB
                    wrote on 21 Oct 2012, 14:47 last edited by
                    #9

                    No problem. Is it working now?

                    Nokia Certified Qt Specialist
                    Interested in hearing about Qt related work

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      McLion
                      wrote on 21 Oct 2012, 14:52 last edited by
                      #10

                      I (believe) I just got it working ... needs some more testing. I need the mouse events because there is a touch screen on (some of) the devices but I don't want to see the mouse cursor.
                      I have added -nomouse to the call ending with
                      /opt/bin/application -nomouse -qws -display directfb --dfb:mode=1280x800

                      Thanks anyway and have a nice (rest) of Sunday

                      1 Reply Last reply
                      1
                      • N Offline
                        N Offline
                        Neil.W
                        wrote on 16 May 2013, 21:40 last edited by
                        #11

                        I could be wrong, but the first thing to take focus in your code example is QSplashScreen, so calling setCursor on QSplashScreen, AND on the root widget would be required.
                        I had a program that worked fine until I added a splash screen, then I had the problem with the cursor until I realized that the splash screen was active some time before the main widget, and added setCursor in both places. Setting an override cursor on the app seemed to have no effect during the startup because the main loop in Qt has not started yet.

                        1 Reply Last reply
                        0
                        • MhM93M Offline
                          MhM93M Offline
                          MhM93
                          wrote on 20 Oct 2016, 07:35 last edited by
                          #12

                          I know this post is really old but when I want to hide mouse pointer and do like this post said :

                          #ifdef Q_WS_QWS
                          QWSServer::setCursorVisible( false );
                          #endif
                          

                          then my device (Friendly ARM) touch does not work. but it works before that.

                          Now how can I restore the touch with pointer like before?

                          H.Ghassami

                          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