hyperspy/hyperspyUI

Cursor color for Line measure tool

magnunor opened this issue · 1 comments

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.

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?