Reputation: 824
Actually I want to create a QLabel
which can be resized by the user, So I found the QSizeGrip class which is used to resized parents window, but actually I want to use this QSizeGrip on my label so that using that grip user can resize my label but the problem I am facing is that this grip when i use with my label resizing my widget window not the label so please provide me code how to make this grip works on QLabel
instead of my widget window. My class till now which inheriting the QLabel
.
class resizeLabel: public QLabel
{
Q_OBJECT
public:
resizeLabel(QWidget *parent=nullptr): QLabel(parent){
setFrameShape(QFrame::Box);
QSizeGrip *resizing= new QSizeGrip(this);
}
Upvotes: 0
Views: 368
Reputation: 824
Use
setWindowFlags(Qt::SubWindow);
That statement after creating QSizeGrip
object, This flag will sit this grip to resize the QLabel
insted of the widget window.
Upvotes: 2