how can I fully disable resizing a window including the resize icon when the mouse hovers the border?
Qt has a windowFlag called Qt::MSWindowsFixedSizeDialogHint
for that. Depending on what you exactly want, you want to combine this flag with Qt::Widget
, Qt::Window
or Qt::Dialog
.
void MyDialog::MyDialog()
{
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
...
}
Try something like this:
this->statusBar()->setSizeGripEnabled(false);
If this doesn't work, all you need to do is detect what widget is activating QSizeGrip. You can do this by installing an event filter on your app and try to catch the QSizeGrip's mouseMoveEvent. Then debug its parent widget.
Here's an example of the eventFilter function you could use:
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if(event->type() == QEvent::MouseMove)
{
QSizeGrip *sg = qobject_cast<QSizeGrip*>(obj);
if(sg)
qDebug() << sg->parentWidget();
}
return false;
}
You could probably catch its show event as well, it's up to you.
One-liner if you know exactly the required size of the window:
this->setFixedSize(QSize(750, 400));