Как реализовать QSizeGrip в безрамном окне Qt? - PullRequest
3 голосов
/ 21 августа 2011

Как я могу реализовать QSizeGrip с безрамным окном Qt?

Каким будет код?

1 Ответ

7 голосов
/ 21 августа 2011

Вам просто нужно добавить 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();
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...