Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor color for Line measure tool #105

Open
magnunor opened this issue Jan 31, 2017 · 1 comment
Open

Cursor color for Line measure tool #105

magnunor opened this issue Jan 31, 2017 · 1 comment

Comments

@magnunor
Copy link
Contributor

When using the Line Measure tool, the cursor changes to a different shape and becomes semi transparent black.

The color is supposed to change based on the color of the image, however this does not work in MacOS or Ubuntu.

@vidartf
Copy link
Member

vidartf commented Feb 1, 2017

The color inversion is only available on Windows, see Qt docs at http://doc.qt.io/qt-4.8/qcursor.html#QCursor-3. The relevant code in HUI is here:

def crosshair_cursor():
if os.name == 'nt':
# On windows, cursors support "inversion" mode, where they invert the
# underlying color. This is achived with two bitmap.
# Final cursor has mask all 0
# When main bitmap is 0, this means transparent, when 1, inversion.
bm = QtGui.QBitmap(16, 16)
ma = QtGui.QBitmap(16, 16)
bm.clear()
ma.clear()
# Paint a crosshair on the main bitmap with color1.
pbm = QtGui.QPainter(bm)
pbm.setPen(QtCore.Qt.color1)
pbm.drawLine(8, 0, 8, 15)
pbm.drawLine(0, 8, 15, 8)
pbm.setPen(QtCore.Qt.color0)
pbm.drawPoint(8, 8)
pbm.end()
return QtGui.QCursor(bm, ma, 8, 8)
else:
fn = os.path.dirname(__file__) + '/images/picker.svg'
return load_cursor(fn, 8, 8)
. On windows it uses a custom cross-hair that relies on the Qt feature linked above; on other platforms it uses a cross-hair SVG.

Maybe your problem could be solved by an improvement to the SVG file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants