stdware / qwindowkit

Cross-platform frameless window framework for Qt. Support Windows, macOS, Linux.
Apache License 2.0
550 stars 89 forks source link

Cannot restore geometry in showEvent #29

Closed razaqq closed 8 months ago

razaqq commented 8 months ago

First of all let me say that this might or might not be a bug, let me explain.

I used to save the geometry of my MainWindow in hideEvent and restore it (setGeometry) in showEvent with FramelessHelper and that used to work flawlessly.

When using qwindowkit however, restoring the geometry in showEvent doesnt work anymore. I have to set it again, after mainWindow->show(); is called.

Before with FramelessHelper:

class MainWindow
{
    void hideEvent(QHideEvent* event)
    {
        // save geometry
    }

    void showEvent(QShowEvent* event)
    {
        // restore geometry
    }
};

MainWindow* main = new MainWindow();
main->show();

Now with qwindowkit:

class MainWindow
{
    void hideEvent(QHideEvent* event)
    {
        // save geometry
    }

    void showEvent(QShowEvent* event)
    {
        // restore geometry - DOESNT WORK
    }
};

MainWindow* main = new MainWindow();
main->show();
main->setGeometry(geo);  // HAVE TO DO IT HERE NOW
wangwenx190 commented 8 months ago

OK, let me investigate.

JulienMaille commented 8 months ago

Restoring geometry was already tricky in the original Frameless, I remember we discussed a couple bugs before you got it right

wangwenx190 commented 8 months ago

Previously we would center the window before show, automatically. So you can't move the window in showEvent. Now this behavior is changed. QWK won't move the window automatically now, you may try latest code to see whether your issue is solved or not.

razaqq commented 8 months ago

yeah its fixed thanks closing