开发者

Draw over QLabel inside QScrollarea

开发者 https://www.devze.com 2023-01-15 15:38 出处:网络
I\'m developing an image viewer, based on a QScrollArea and a QLabel that contains the image to show.

I'm developing an image viewer, based on a QScrollArea and a QLabel that contains the image to show.

Now, I need to show text over the l开发者_如何学Pythonabel, like the current mouse (x,y) position, image size, etc., in a specific point, but it can't be affected by the scrolling.

How can I do this?


The first thing I would try is:

container = new QWidget();
scrollArea = new QScrollArea(container);
pic = new QLabel();
pic->setPixmap(...);
scrollArea->setWidget(pic);
infoLabel = new QLabel("mouse is at 0, 0", container);
infoLabel->move(20, 20); // the desired non-scrolling position
0

精彩评论

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