laserpants / qt-material-widgets

:art: Qt widgets-based implementation of the Material Design specification.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QtMaterialDialog: overlay gets wrong size and position

ZimNovich opened this issue · comments

When I am instantiating an object of QtMaterialDialog class, the overlay gets incorrectly positioned and resized. I do it this way:

// Show Preferences
QtMaterialDialog* prefs = new QtMaterialDialog(this);
// Adding child objects and stuff
. . .
prefs->setWindowLayout(dialogLayout);
prefs->show();
prefs->showDialog();

The possible solution is to call setGeometry(overlayGeometry()) in the constructor of QtMaterialOverlayWidget:

QtMaterialOverlayWidget::QtMaterialOverlayWidget(QWidget *parent)
: QWidget(parent)
{
    if (parent) {
        parent->installEventFilter(this);
        setGeometry(overlayGeometry() );
    }
}

The old version of QtMaterialOverlayWidget's constructor was:

QtMaterialOverlayWidget::QtMaterialOverlayWidget(QWidget *parent)
    : QWidget(parent)
{
    if (parent) {
        parent->installEventFilter(this);
    }
}