簡體   English   中英

如何在Qt無框窗口中實現QSizeGrip?

[英]How to implement QSizeGrip in a Qt frameless window?

如何使用Qt無框窗口實現QSizeGrip?

代碼會是什么樣的?

您只需在布局內的窗口一角添加一個QSizeGrip,使其保持在該角落。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM