首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Qt无框架窗口中实现QSizeGrip?

如何在Qt无框架窗口中实现QSizeGrip?
EN

Stack Overflow用户
提问于 2011-08-22 00:33:18
回答 1查看 7.1K关注 0票数 3

如何在Qt无框架窗口中实现QSizeGrip?

代码会是什么样子的?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-22 02:46:09

你只需要在布局中窗口的一角添加一个QSizeGrip,就可以让它停留在那个角落。

代码语言:javascript
复制
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();
票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7139559

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档