I am currently working with OpenGL and i need to place a QLabel in a corner of my window, and when I make a resizing in the window, the label goes back to the corner of the window.
I am using the function
void MyClass::myFunction()
{
label->move( mapToGlobal( QPoint( 460, 425 )));
}
And in my paintGL() method
void MyClass::paintGL
{
myFunction();
}
but when i maximize the window, i can not put the label back in the corner. I have read other topics but i can not find the solution.
Ok, i found the solution.
replacing move method for setGeometry.
label->setGeometry((this->width() - label->sizeHint().width() / 2),
this->height() - label->sizeHint().height()/ 2,
label->sizeHint().width(), label->sizeHint().height());
thanks a lot.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.