[Qt-interest] Painting question

Robert Hairgrove evorgriahr at hispeed.ch
Sun Aug 16 12:49:08 CEST 2009


I would like to paint on a widget but only AFTER starting a drag 
operation. The documentation says not to use QPainter except inside a 
widget's paintEvent() function (there is a way on Linux, but not on 
Windows).

My scenario is this: in a class derived from QTableView, I display a 
schedule of lessons with individual students' names displayed in a 
timetable. I have successfully implemented the drag & drop functionality 
which allows the user to change lessons by dragging the students around 
in the timetable.

What I would like to do is to display a little green dot or icon in the 
available spaces to show the user the location of the available slots 
depending on the student's free hours for the lesson which is being dragged.

I am looking for suggestions on the best possible approach (or any 
approach which works, for that matter). Since the QDrag::exec() function 
is a blocking function, I don't think I can use QPainter once it has 
started ... or is it possible?

Thanks!



More information about the Qt-interest-old mailing list