views:

130

answers:

0

I am writing a drawing program using PyQt4 for Windows 7. When my program is in "Drawing" mode, I use a InkCollector COM object to collect the ink strokes. When the tablet stylus is pressed down, the InkCollector object supresses the cursor and only shows a writing tip. When the stylus is hovering, I see the normal cursor and it flickers terribly. Here is a minimal example:

import win32com.client
from PyQt4 import QtGui

app = QtGui.QApplication([])
mainwindow = QtGui.QMainWindow()
mainwindow.show()

inkcol = win32com.client.Dispatch('msinkaut.InkCollector')
inkcol.hWnd = int(mainwindow.winId())
inkcol.Enabled = True
res = app.exec_()

I tried setting InkCollector.AutoRedraw=False. I have put in a custom QWidget and overridden its paint method to see if it is receiving paintEvents, and it is not. It seems that the flickering cursor is due to a conflict between Windows at Qt, not due to my code.

I would be grateful for any advice. Does Qt4 on Windows just use the standard win32 SetCursor function, or does it have its own routines for drawing cursors? If the latter, is there any way I could persuade it to use win32 SetCursor, in the hope that it will play nicer with InkCollector?