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. setCursor() stops working after interacting with QMessageBox using space key

setCursor() stops working after interacting with QMessageBox using space key

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 4 Posters 1.7k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by SGaist
    #2

    Hi and welcome to devnet,

    Are you using exec or open ?
    If the former, can you test with the latter ?

    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
    0
    • K Offline
      K Offline
      Kevin Hoang
      wrote on last edited by
      #3

      I am using confirmBox.exec() because I want the user to confirm before proceeding. The blocking behavior is intentional in this case.

      However, I am also facing another issue with QGraphicsRectItem:

      After zooming in or out, the hover event does not work in a ~10px area at the bottom edge of the RectItem. Additionally, setCursor does not take effect until I move the application window.

      I suspect these issues might be related, but I donโ€™t think they are caused by exec(). Do you have any insights on what might be happening?

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

        wrt to the QGraphicsrectItem - any chance you hit bug https://bugreports.qt.io/browse/QTBUG-131893 ?
        Please provide a minimal, compilable example to reproduce the problem.

        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
        • K Offline
          K Offline
          Kevin Hoang
          wrote on last edited by
          #5

          I've provided a minimal, compilable example to reproduce the issue. You can find it here:
          ๐Ÿ‘‰ GitHub Repository: QGraphicsBug

          The repository includes build instructions and a detailed Steps to Reproduce section in the README.

          Would appreciate any insights or suggestions. Thanks!

          1 Reply Last reply
          1
          • K Offline
            K Offline
            Kevin Hoang
            wrote on last edited by
            #6

            I've noticed something interesting: If an action automatically triggers a QMessageBox, and I press Space to interact with it, the issue occurs. However, if I repeat the same action one more time, setCursor() starts working again.

            This suggests that Qt's internal state might not be resetting correctly after the first QMessageBox interaction, but it somehow corrects itself on the second occurrence.

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

              I can't reproduce it with Qt6.8.2 or Qt6.10 on windows with msvc.

              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
              • K Offline
                K Offline
                Kevin Hoang
                wrote on last edited by
                #8

                Thanks for testing it!

                I'm running this on macOS Sequoia 15.3.2 with Qt 6.8.2, using Apple Clang 16.0.0. The issue is consistently reproducible on my setup. This might be a macOS-specific issue.

                Would it make sense to report this on Qt's bug tracker (bugreports.qt.io)?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Yes it would, I was able to reproduce the issue on Sonoma with a self built version of Qt.

                  Please provide your example directly in the bug report so it will keep things together.

                  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
                  1
                  • K Offline
                    K Offline
                    Kevin Hoang
                    wrote on last edited by
                    #10

                    I really appreciate you taking the time to look into this issue!

                    I have submitted the bug report to Qt's bug tracker and included the minimal example directly in the report. Here is the link for reference: QTBUG-135154

                    1 Reply Last reply
                    1
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Thanks !

                      Please add a tar file with your project to the report. That way it's easier for people to work on this.

                      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
                      0
                      • Q Offline
                        Q Offline
                        qtGraham
                        wrote last edited by
                        #12

                        I am encountering similar problems with Linux Mint. I am new to Mint, new to Qt, my C++ is very rusty, and I don't do much GUI programming. I am surprised to find a problem that apparently isn't my fault.

                        I am porting a simple painting program (Stracian) from a Windows version I wrote 20-odd years ago. It uses a tablet. I started with the Tablet example (Qt/Examples/Qt-6.10.1/widgets/widgets).

                        Tablet has a problem like "the hover" problem. Moving the cursor slowly into the window from top, bottom, or right, does not change the cursor. Moving in quickly, or from the left works OK. Tablet does not have the child-dialog problem. In fact, you can restore the correct cursor by opening and closing the About dialog.

                        Stracian does not have the hover problem, but it does have the child-dialog problem. I can fix it by passing a null pointer as parent to the dialog, but I expect that has negative consequences elsewhere.

                        Tablet uses a QPixmap, Stracian does not. I have my own data structure for the image, which I convert to QImages for painting the window. I don't know if that's relevant, but I can't see other obvious differences between Tablet and Stracian.

                        I couldn't build the QGraphicsBug example:

                        [cmake] Running /home/graham/Qt/Tools/CMake/bin/cmake -S /home/graham/Desktop/QGraphicsBug -B /home/graham/Desktop/QGraphicsBug/build/Desktop-Debug2 in /home/graham/Desktop/QGraphicsBug/build/Desktop-Debug2.
                        [cmake] -- Qt Creator: QT_QMAKE_EXECUTABLE was not set. Qt MaintenanceTool cannot be used to install missing Qt modules that you specify in find_package(). To disable this message set QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER to ON.
                        [cmake] -- Configuring incomplete, errors occurred!
                        [cmake] CMake Error at CMakeLists.txt:21 (find_package):
                        [cmake] By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
                        [cmake] asked CMake to find a package configuration file provided by "Qt6", but
                        [cmake] CMake did not find one.
                        [cmake]
                        [cmake] Could not find a package configuration file provided by "Qt6" with any of
                        [cmake] the following names:
                        [cmake]
                        [cmake] Qt6Config.cmake
                        [cmake] qt6-config.cmake
                        ....

                        SGaistS 1 Reply Last reply
                        0
                        • Q qtGraham

                          I am encountering similar problems with Linux Mint. I am new to Mint, new to Qt, my C++ is very rusty, and I don't do much GUI programming. I am surprised to find a problem that apparently isn't my fault.

                          I am porting a simple painting program (Stracian) from a Windows version I wrote 20-odd years ago. It uses a tablet. I started with the Tablet example (Qt/Examples/Qt-6.10.1/widgets/widgets).

                          Tablet has a problem like "the hover" problem. Moving the cursor slowly into the window from top, bottom, or right, does not change the cursor. Moving in quickly, or from the left works OK. Tablet does not have the child-dialog problem. In fact, you can restore the correct cursor by opening and closing the About dialog.

                          Stracian does not have the hover problem, but it does have the child-dialog problem. I can fix it by passing a null pointer as parent to the dialog, but I expect that has negative consequences elsewhere.

                          Tablet uses a QPixmap, Stracian does not. I have my own data structure for the image, which I convert to QImages for painting the window. I don't know if that's relevant, but I can't see other obvious differences between Tablet and Stracian.

                          I couldn't build the QGraphicsBug example:

                          [cmake] Running /home/graham/Qt/Tools/CMake/bin/cmake -S /home/graham/Desktop/QGraphicsBug -B /home/graham/Desktop/QGraphicsBug/build/Desktop-Debug2 in /home/graham/Desktop/QGraphicsBug/build/Desktop-Debug2.
                          [cmake] -- Qt Creator: QT_QMAKE_EXECUTABLE was not set. Qt MaintenanceTool cannot be used to install missing Qt modules that you specify in find_package(). To disable this message set QT_CREATOR_SKIP_MAINTENANCE_TOOL_PROVIDER to ON.
                          [cmake] -- Configuring incomplete, errors occurred!
                          [cmake] CMake Error at CMakeLists.txt:21 (find_package):
                          [cmake] By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
                          [cmake] asked CMake to find a package configuration file provided by "Qt6", but
                          [cmake] CMake did not find one.
                          [cmake]
                          [cmake] Could not find a package configuration file provided by "Qt6" with any of
                          [cmake] the following names:
                          [cmake]
                          [cmake] Qt6Config.cmake
                          [cmake] qt6-config.cmake
                          ....

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote last edited by
                          #13

                          @qtGraham Hi and welcome to devnet,

                          The error message is pretty strange...
                          One thing you can test is to build the example on the command line using the qt-cmake wrapper found in your Qt 6 installation. That should make the build easier to do.

                          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
                          0
                          • Q Offline
                            Q Offline
                            qtGraham
                            wrote last edited by
                            #14

                            I was able to build QGraphicsBug by starting a new project and adding the files. It crashed when I ran it, SEGV in ImageViewer::setupScene() because imageItem was not initialized to 0. When I fixed that it ran OK, and the cursors behaved properly. I'm back to thinking my problem is my fault.

                            1 Reply Last reply
                            0
                            • Q Offline
                              Q Offline
                              qtGraham
                              wrote last edited by qtGraham
                              #15

                              I have made a minimal example for my problem. The project has 5 files in the same folder: two images for cursors, and resfile.qrc, main.cpp, CMakeLists.txt. Link below..

                              To show the problem, put cursor in window, use F2 and F3 to change the cursor. Press F1 to open the dialog, click on label, press escape to close dialog. F2 and F3 no longer work.

                              As I said, I'm new to QT Creator and my C++ is very rusty, so I expect I've done something silly.

                              download example

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote last edited by
                                #16

                                You seem to be in the case described in QTBUG-135203.

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

                                Q 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  You seem to be in the case described in QTBUG-135203.

                                  Q Offline
                                  Q Offline
                                  qtGraham
                                  wrote last edited by qtGraham
                                  #17

                                  @SGaist Well that's how it seemed to me originally, though I cannot reproduce Kevin's issues (at least on Linux Mint) and Christian Ehrlicher couldn't reproduce them on Windows. OTOH mine occurs with Linux Mint and Win11 too. I can work around it.

                                  I have tried to post the source code directly but my message gets flagged as spam.

                                  SGaistS 1 Reply Last reply
                                  0
                                  • Q qtGraham

                                    @SGaist Well that's how it seemed to me originally, though I cannot reproduce Kevin's issues (at least on Linux Mint) and Christian Ehrlicher couldn't reproduce them on Windows. OTOH mine occurs with Linux Mint and Win11 too. I can work around it.

                                    I have tried to post the source code directly but my message gets flagged as spam.

                                    SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote last edited by
                                    #18

                                    @qtGraham With your reproducer I can see it happening on macOS.

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

                                    Q 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      @qtGraham With your reproducer I can see it happening on macOS.

                                      Q Offline
                                      Q Offline
                                      qtGraham
                                      wrote last edited by
                                      #19

                                      @SGaist Thanks.

                                      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