Skip to content
QtWS25 Last Chance
  • 0 Votes
    1 Posts
    815 Views
    No one has replied
  • 0 Votes
    3 Posts
    3k Views
    ajvanho6A
    Hello @p3c0 thank you for helping. Unfortunately i did try as you suggested but no luck so far. Mouse wheel is not responding it just wok when i press and drag Don't know what could be the issue. I must check other files of my app maybe something is interfering with this file.
  • 0 Votes
    2 Posts
    968 Views
    p3c0P
    @dzimiwine Did you try acceptedButtons ? acceptedButtons: Qt.MiddleButton : Qt.RightButton
  • Get mouse position relative to an item.

    QML and Qt Quick mousearea
    1
    0 Votes
    1 Posts
    497 Views
    No one has replied
  • Problem with MouseArea in delegate

    Solved QML and Qt Quick mousearea
    14
    0 Votes
    14 Posts
    7k Views
    p3c0P
    @nnnnn Hmm. I overlooked your onEntered requirement. It doesnot work in my example. The problem is that once you set mouse.accepted=false the release event is not trapped.
  • 0 Votes
    3 Posts
    2k Views
    A
    I still had to remove the QWidget.. it's useless this way. My error was that I can't have a QWidget class without a QQmlApplicationEngine.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    2 Posts
    957 Views
    P
    This problem occurs in qt 5.4 under linux. I just checked, and it doesn't occur under 5.3 - there, onExit is correctly triggered even on drag-release outside the GridView.
  • 0 Votes
    5 Posts
    5k Views
    sosunS
    @mcosta Actually, my problem is solved. Thanks to @t3685 for the solution. I've just forgot to mark it as SOLVED. Anyway, thanks ;)
  • 0 Votes
    5 Posts
    6k Views
    momoM
    @nedo99: A big thanks for the tip! That in fact solved my problem, but maybe not in the way you might have thought! I finally got it to work this way: MouseArea { id: myMouseArea property point cursorPos property bool cursorPosActive : false // new code to handle flicking property point startFlickContentRef: Qt.point(0, 0) property point startFlickMousePos: Qt.point(mouseX, mouseY) property bool flicking: false function setStartFlickMousePos(x,y) { // "prepare" for flicking whenever we have a legitimate mouse pos... if (!flicking) // ...but are not actually flicking! startFlickMousePos = Qt.point(x,y) } function startFlick(refPt) { // Note: startFlick() might be called multiple times before endFlick() is called... if (!flicking) { // ...so this is an important check! startFlickContentRef = refPt flicking = true } } function endFlick(refPt) { if (flicking) { var diffX = refPt.x - startFlickContentRef.x var diffY = refPt.y - startFlickContentRef.y statBar.cursorPos = Qt.point(startFlickMousePos.x + diffX, startFlickMousePos.y + diffY) flicking = false } } anchors.fill: parent hoverEnabled: true onClicked: { // MouseEvent OK cursorPos = Qt.point(mouse.x, mouse.y) setStartFlickMousePos(mouse.x, mouse.y) } onEntered: { // here: mouseX/Y OK? cursorPos = Qt.point(mouseX, mouseY) setStartFlickMousePos(mouseX, mouseY) cursorPosActive = true } onExited: { cursorPosActive = false } onPositionChanged: { // MouseEvent OK cursorPos = Qt.point(mouse.x, mouse.y) setStartFlickMousePos(mouse.x, mouse.y) } onWheel: { // WheelEvent OK cursorPos = Qt.point(wheel.x, wheel.y) setStartFlickMousePos(wheel.x, wheel.y) wheel.accepted = false; // pass to Flickable } } Then I added the following code to my Flickable: onFlickStarted: { myMouseArea.startFlick(Qt.point(contentX, contentY)) } onFlickEnded: { myMouseArea.endFlick(Qt.point(contentX, contentY)) } Note that it turned out to be important to use onFlickStarted/Ended instead of onMovementStarted/Ended. Also it's important to update the startFlickMousePos at every opportunity, because at the point where I normally would want to set it (in startFlick()), I might not have a valid mouseX and mouseY (that was the reason for this post in the first place!). Again thanks! Together we are strong!
  • Zoom at Mouse position

    General and Desktop qt5.4 mousearea flickable image
    8
    1 Votes
    8 Posts
    9k Views
    p3c0P
    @shedo Hmm. Well then try to use the only relevant code from the blog post into your original code. The code of interest would be the one in onWheel handler and the properties it updates.
  • 0 Votes
    4 Posts
    2k Views
    p3c0P
    @maxsivkov Scenario is to have several elements (images with attached mouseareas (to change image source when mouse is inside the image) and also show hints (tooltips) for listview's item. So its better no to do it when the ListView scrolls and only when user hovers mouse over that particular Item To show tooltip my idea was to sit on a onPositionChanged event and restart timer, stop it in onExited event. I think better to use onEntered and onExited. Using onPositionChanged will continuously restart it as mouse moves. Also hide it after a particular timeout instead of only in onExited.