开发者

Qt with multiple (two) GUI/Graphics layers or buffers

开发者 https://www.devze.com 2023-02-24 23:09 出处:网络
Greet开发者_开发知识库ings, I\'m just starting to explore Qt and I\'m wondering if the following is possible.I\'d like to create a application with two GUI/Graphics layers.The top layer (call it A) w

Greet开发者_开发知识库ings,

I'm just starting to explore Qt and I'm wondering if the following is possible. I'd like to create a application with two GUI/Graphics layers. The top layer (call it A) will sit on top of the bottom layer (call it B) and both will sit on top of the application. If a button exists at the same location in both layers, only the button in A should be visible and respond to click events. Buttons in layer B should only receive click events if the corresponding location in layer A is empty. I'd really like Qt to handle this for me. What would be the easiest way to do this?

It is possible I'm attacking the problem from the wrong angle. The driver for this questions is that I want a screen shot of what is present in layer B (regardless of whether or not it is covered by a widget in layer A). I do not want items from layer A in that screen shot, but they should still be present on the screen. My thought was that by splitting the GUI into two layers and drawing into a Pixmap, I could easily extract the Qt-created image of the bottom layer B. Perhaps there is an easier way of getting Qt to draw the elements I want into off screen buffer?

By the way, I'm not looking for a full solution here. The Qt documentation is excellent, so I'm really just hoping to be pointed in the right direction. Thanks!


Sounds like a job for QGraphicsView. This will do exactly what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消