[Interest] QPainter drawLine zValue?
Israel Brewster
ijbrewster at alaska.edu
Wed Sep 25 23:23:15 CEST 2019
> On Sep 25, 2019, at 9:13 AM, Israel Brewster <ijbrewster at alaska.edu> wrote:
>
> Is there a way to set the Z value of the line drawn by the QPainter::DrawLine() function? I have a library that uses the drawLine function to create a grid, and I would like to keep the grid on the top as I draw other things, if possible. Thanks.
So after doing some additional digging in the library code that actually does the drawing, I found out that the solution is actually quite simple, though undocumented. The event that does the drawing draws into a QGraphicsWidget, which is then added to a QGraphicsScene. At the point where it is added, the library sets the z value of the QGraphicsWidget to -1000. So in the end, all I had to do was override this setting with something a bit more positive, *after* it had been added, and viola!
So I guess I did a poor job of asking the question, since I only referenced the paint() event where the grid was actually drawn, and not the fact it was being drawn onto a QGraphicsWidget that is added to a QGraphicsScene. Sorry! Though in my defense, I hadn’t actually figured out the details of how it all worked yet…
>
> ---
> Israel Brewster
> Software Engineer
> Alaska Volcano Observatory
> Geophysical Institute - UAF
> 2156 Koyukuk Drive
> Fairbanks AK 99775-7320
> Work: 907-474-5172
> cell: 907-328-9145
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190925/b1423d94/attachment.html>
More information about the Interest
mailing list