开发者

How to implement QSizeGrip in a Qt frameless window?

开发者 https://www.devze.com 2023-03-29 21:07 出处:网络
How can I implement QSizeGrip with a Qt frameless window? What would the code be like?开发者_如何学运维You just have to add a QSizeGrip in a corner of your window inside a layout to make it stay in

How can I implement QSizeGrip with a Qt frameless window?

What would the code be like?开发者_如何学运维


You just have to add a QSizeGrip in a corner of your window inside a layout to make it stay in that corner.

QDialog *dialog = new QDialog(0, Qt::FramelessWindowHint);
QVBoxLayout *layout = new QVBoxLayout(dialog);

// To remove any space between the borders and the QSizeGrip...      
layout->setContentsMargins(QMargins());         
// and between the other widget and the QSizeGrip
layout->setSpacing(0);
layout->addWidget(new QTextEdit(dialog));

// The QSizeGrip position (here Bottom Right Corner) determines its
// orientation too
layout->addWidget(new QSizeGrip(dialog), 0, Qt::AlignBottom | Qt::AlignRight);

dialog->show();
0

精彩评论

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