GithubHelp home page GithubHelp logo

Comments (1)

mitchcurtis avatar mitchcurtis commented on May 25, 2024

Hi, thank you for the feedback. :)

I am using Qt Quick items for the cursors currently:

CrosshairCursor {
id: crosshairCursor
x: canvas ? canvas.cursorX - width / 2 : 0
y: canvas ? canvas.cursorY - height / 2 : 0
z: 1
colour: canvas ? canvas.invertedCursorPixelColour : defaultColour
visible: canvas && canvas.hasBlankCursor && !canvas.useIconCursor && (canvas.useCrosshairCursor || settings.alwaysShowCrosshair)
}
RectangularCursor {
id: rectangleCursor
x: canvas ? Math.floor(canvas.cursorX - width / 2) : 0
y: canvas ? Math.floor(canvas.cursorY - height / 2) : 0
z: 1
width: canvas ? canvas.toolSize * canvas.currentPaneZoomLevel : 0
height: canvas ? canvas.toolSize * canvas.currentPaneZoomLevel : 0
visible: canvas && canvas.hasBlankCursor && !canvas.useIconCursor && !canvas.useCrosshairCursor
}
Label {
id: iconCursor
x: canvas ? canvas.cursorX : 0
y: canvas ? canvas.cursorY - height + 3 : 0
z: 1
visible: canvas && canvas.hasBlankCursor && canvas.useIconCursor
text: visible && checkedToolButton ? checkedToolButton.text : ""
font.family: "FontAwesome"
color: canvas ? canvas.invertedCursorPixelColour : crosshairCursor.defaultColour
}

The benefit of this approach is that the cursors can be coloured, which means we can also use the inverse of the colour under the pixel to ensure that the cursor has good visibility due to contrast.

Another advantage is that we can have nice, smooth cursors. From memory, a custom QCursor shape will be quite blocky and not smooth, but I'd have to double-check that.

The disadvantage is, as you've seen, it can lag behind the mouse a bit due to it not being a system cursor. That's unrelated to signals and slots though, I think.

from slate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.