Skip to content
  • TableView highlight column on mouse-over

    Unsolved QML and Qt Quick tableview columnat highlight mouse
    2
    0 Votes
    2 Posts
    3k Views
    K
    Ive been looking into this a bit more myself and ive found that the TableView headerVisible property makes a big difference. I am currently hiding the header. When headerVisible=false then tableView.__listView.columnAt(x) always returns -1. When headerVisible=true then tableView.__listView.columnAt(x) works correctly. Id like to keep the table's header hidden if possible, hopefully a workaround for tableView.__listView.columnAt(x) is possible. Also, im on Windows with Qt5.5.1 mingw if that makes any difference.
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    2 Posts
    986 Views
    SGaistS
    Hi, QWidget::mousePressEvent is probably what you are looking for
  • 0 Votes
    5 Posts
    3k Views
    N
    I looked at using the QMouseEvent and using the ignore() function, but the computer still took input from the mouse. Although I have found filters for it, I don't understand them and would like to simply disable input from the mouse. What would you reccomend aside from the mouseMoveEvents, which I didn't fully understand?
  • Mouse cursor doesn't move

    Mobile and Embedded qt5 mouse keyboard cursor
    1
    0 Votes
    1 Posts
    835 Views
    No one has replied
  • Issues with wheelEvent under Linux

    General and Desktop wheel mouse event bug
    3
    0 Votes
    3 Posts
    2k Views
    R
    I had an old mouse that gave irratic scroll wheel signals. It still worked but I did notice it jumpy when trying to scoll windows on occasion (all windows, not just Qt). I don't know what you are using but I would make sure the problem is not hardware.
  • QNSView mouseDragged QWarning

    General and Desktop macosx qnsview mouse qmenu
    3
    0 Votes
    3 Posts
    2k Views
    mmirskyM
    Hi SGaist, Thanks for the tip. I made a comment on the linked bug. Hopefully, that helps someone!
  • 0 Votes
    3 Posts
    2k Views
    R
    Yes I am sure, the one with the capital is a signal while the other is a slot
  • Animation only when mouse enters image

    QML and Qt Quick animation mouse over
    2
    0 Votes
    2 Posts
    905 Views
    p3c0P
    Hi @vladinko0, You can use onEntered handler to trigger the animation.
  • Moving contents on MouseArea hover

    QML and Qt Quick qml qtquick qt 5.4 mouse
    4
    0 Votes
    4 Posts
    2k Views
    sierdzioS
    OK, here are my suggestions: use Flickable's flick() method link. It should work better than your solution, be more fluid and natural-looking 1ms timer resolution is completely useless: QtQuick updates the screen (paints a new frame) every 16.6 ms to achieve constant 60 Hz refresh rate. So you are wasting time and CPU power by invoking it 16 times more often than the software can pain it ;-) I'd suggest setting it to at least 16ms, but in reality I would probably use 50-100ms and tweak it to look good using flick() method mentioned above
  • 0 Votes
    6 Posts
    8k Views
    D
    In case you come across this a bit more complete example, including handling of contentY changing because of scroll...: MouseArea {id: selectionMouseArea property alias selectionRect : selectionRect property int initialXPos property int initialYPos property int mouseX property int mouseY anchors.fill: grid acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton Rectangle {id: selectionRect visible: false x: 0 y: 0 z: 99 width: 0 height: 0 rotation: 0 radius: 5 color: "#5F227CEB" border.width: 1 border.color: "#103A6E" transformOrigin: Item.TopLeft } //selectionRect //moving close to top or bot end scrolls view depending on speed Timer {repeat: true;running: ( parent.mouseY < 0 && grid.contentY>0 ) && parent.pressed && !grid.atYBeginning; interval: 10; onTriggered: grid.contentY -= (-1 * parent.mouseY), returnToBounds() } Timer {repeat: true;running: ( parent.mouseY > grid.height) && parent.pressed && !grid.atYEnd interval: 10; onTriggered: grid.contentY += 1 * ( parent.mouseY -grid.height ), returnToBounds() } //makes the rectangle smooth Connections { target: grid onContentYChanged: //selectionRect needs to be depending onConentY as its size and position depends on that { if (selectionRect.rotation == 0 || selectionRect.rotation == -180) { selectionRect.y = selectionMouseArea.initialYPos - grid.contentY selectionRect.height = Math.abs(selectionMouseArea.mouseY - selectionMouseArea.initialYPos + grid.contentY) selectionRect.width = Math.abs(selectionMouseArea.mouseX - selectionRect.x) } else { selectionRect.y = selectionMouseArea.initialYPos - grid.contentY selectionRect.height = Math.abs(selectionMouseArea.mouseX - selectionRect.x) selectionRect.width = Math.abs(selectionMouseArea.mouseY - selectionRect.y) } } } onClicked: { if(mouse.button == Qt.RightButton) { mouse.accepted=false return; } if ( wasHeld || mouse.modifiers & Qt.ControlModifier ) return; initialXPos=mouse.x; initialYPos=mouse.y;mouseX=mouse.x;mouseY=mouse.y } onPressed: { if(mouse.button == Qt.RightButton) { mouse.accepted=false return; } if (mouse.modifiers & Qt.ControlModifier) { console.log("ControlModifier"); mouse.accepted=false return; } if (mouse.button == Qt.LeftButton) { initialXPos = mouse.x initialYPos = mouse.y+grid.contentY grid.interactive = false selectionRect.x = mouse.x selectionRect.y = mouse.y selectionRect.width = 0 selectionRect.height = 0 } if(itemAt(mouse.x,mouse.y+grid.contentY).hovered) mouse.accepted=false if(itemAt(mouse.x,mouse.y+grid.contentY).hovered===false) { ufm().resetSelection() grid.currentIndex=-1 } } onPositionChanged: { // console.log(selectionRect.height); // console.log(selectionRect.width); if(mouse.button == Qt.RightButton) { mouse.accepted=false return; } if (mouse.modifiers & Qt.ControlModifier) { return; } selectionRect.visible = true if (selectionRect.visible === false) { selectionRect.x = 0 selectionRect.y = 0 selectionRect.width = 0 selectionRect.height = 0 initialXPos = 0 initialYPos = 0 } if (selectionRect.visible === true) { mouseX = mouse.x mouseY = mouse.y if (Math.abs(mouseX, initialXPos)>30) wasHeld = true if (Math.abs(mouseY, initialYPos)>30) wasHeld = true if (mouse.x >= initialXPos) { if (mouse.y+grid.contentY >= initialYPos) selectionRect.rotation = 0 else selectionRect.rotation = -90 } else if (mouse.x <= initialXPos) { if (mouse.y+grid.contentY >= initialYPos) selectionRect.rotation = 90 else selectionRect.rotation = -180 } if (selectionRect.rotation == 0 || selectionRect.rotation == -180) { selectionRect.y = initialYPos - grid.contentY selectionRect.height = Math.abs(mouse.y - initialYPos + grid.contentY) selectionRect.width = Math.abs(mouse.x - selectionRect.x) } else { selectionRect.y = initialYPos - grid.contentY selectionRect.height = Math.abs(mouse.x - selectionRect.x) selectionRect.width = Math.abs(mouse.y - selectionRect.y) } } } onReleased: { selectionRect.visible = false // restore the Flickable duties grid.interactive = true } onWheel: { if (wheel.angleDelta.y > 0 && !grid.atYBeginning) grid.contentY -= 50 else if (wheel.angleDelta.y < 0 && !grid.atYEnd) grid.contentY += 50 } }