我正在开发一个基于 QScrollArea 和包含要显示的图像的 QLabel 的图像查看器。
现在,我需要在特定点显示标签上的文本,例如当前鼠标 (x,y) 位置、图像大小等,但它不受滚动的影响。
我该怎么做?
最佳答案
我首先要尝试的是:
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
关于c++ - 在 QScrollarea 内绘制 QLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3695168/