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. Problem with mouse cursor icon when snapping window to screen edge

Problem with mouse cursor icon when snapping window to screen edge

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 1.3k 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.
  • achojoaoA Offline
    achojoaoA Offline
    achojoao
    wrote on last edited by achojoao
    #1

    Hi all!

    I'm struggling with one weird problem. In my desktop app, I have a MouseArea which has a hover action that changes the mouse cursor icon whenever the mouse goes into it. When I resized the app window, the functionality still works. The problem arises when I drag&snap the app window to the edges/top of my screen (only tested in MacOS High Sierra). The window adapts itself to the predeterminated dimensions, but the hover action seems to stop working (even if I see in console that the mouse is in fact hovering the area an the onPositionChanged is being called).

    Does anybody know the why of this behavior? Any idea what I'm possibly doing wrong or not taking into account?

    Thanks in advance!

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

      Hi and welcome to devnet,

      Can you provide a minimal compilable example that shows that behaviour ?

      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
      • achojoaoA Offline
        achojoaoA Offline
        achojoao
        wrote on last edited by SGaist
        #3

        Thanks SGaist to check it out! The content of the main.qml file of a simple project which suffers the same problem:

        import QtQuick 2.9
        import QtQuick.Window 2.2
        
        Window {
            visible: true
            width: 640
            height: 640
            title: qsTr("Hello World")
        
            Rectangle {
                width: 500
                height: 500
                anchors.centerIn: parent
        
                Flickable {
                    id: flickable
                    width: parent.width
                    height: parent.width
                    anchors.fill: parent
                    anchors.margins: 6
                    clip: true
                    contentWidth: myImage.width
                    contentHeight: myImage.height
                    contentX: (myImage.width / 2) - (width / 2)
                    contentY: (myImage.height / 2) - (height / 2)
                    boundsBehavior: Flickable.StopAtBounds
                    pressDelay: 1
        
                    Image {
                        id: myImage
                        cache: false
                        source: "https://www.gravatar.com/avatar/07682a4fa2355ff3ecce1d522458e3e7?size=192&d=mm"
        
                        MouseArea {
                            id: myMouseArea
                            anchors.fill: parent
                            hoverEnabled: true
                            onPositionChanged: {
                                if (myMouseArea.containsPress) {
                                    myMouseArea.cursorShape = Qt.ClosedHandCursor;
                                } else {
                                    myMouseArea.cursorShape = Qt.OpenHandCursor;
                                }
                            }
                            onReleased: {
                                myMouseArea.cursorShape = Qt.OpenHandCursor;
                            }
                        }
                    }
                }
        
        
            }
        }
        

        [edit: added missing coding tags SGaist]

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

          What version of Qt are you using ?

          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
          • achojoaoA Offline
            achojoaoA Offline
            achojoao
            wrote on last edited by
            #5

            Qt Creator 4.5.1
            Qt 5.10.1 (Clang 7.0 (Apple), 64 bit)
            Built on Feb 10 2018 04:23:48
            From revision 24cd0b1cd6

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

              Since Qt 5.11 just got released, can you check if you still have the same problem with it ?

              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
              • achojoaoA Offline
                achojoaoA Offline
                achojoao
                wrote on last edited by
                #7

                Still the same error with:

                Qt Creator 4.7.0-beta1 (4.6.82)
                Based on Qt 5.11.0 (Clang 8.0 (Apple), 64 bit)
                Built on Jun 4 2018 10:36:27
                From revision f1881ac2fc

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

                  I didn't realise, those are the information about Qt Creator itself, not the kit you are currently using to build your application.

                  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
                  • achojoaoA Offline
                    achojoaoA Offline
                    achojoao
                    wrote on last edited by
                    #9

                    Qt_5_11_0_clang_64bit

                    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