如何在Qt frameless窗口中实现QSizeGrip? [英] How to implement QSizeGrip in a Qt frameless window?

查看:1556
本文介绍了如何在Qt frameless窗口中实现QSizeGrip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何实现QSizeGrip与一个Qt无框窗口?

How can I implement QSizeGrip with a Qt frameless window?

代码是什么样子?

推荐答案

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();

这篇关于如何在Qt frameless窗口中实现QSizeGrip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆