M
M
Mercury132015-10-21 18:16:43
Qt
Mercury13, 2015-10-21 18:16:43

Qt: how to get non-maximized window coordinates?

The task is to save the coordinates of the non-maximized window in the config. No matter how I tried, it didn't work. Expand the window, restart the program - it turns out that the expanded coordinates are saved.
Here is the code called from moveEvent and resizeEvent.

void fmMain::saveNonMaxGeometry()
{
    if (!isMaximized()) {
        nonMaxGeometry = geometry();
    }
}

And still, the branch fires when the window is maximized. What to do?
PS It turned out, but it's very dirty and guaranteed to fail when Qt is fixed. Maybe one of you can come up with a cleaner code?
PPS OS - Windows 7.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2015-11-17
@Mercury13

normalGeometry()

B
beu, 2015-10-29
@beu

Try QWidget::saveGeometry and QWidget::restoreGeometry should work
By the way, it doesn't work because of resizeEvent, it comes before maximizing and therefore remembers the maximum window sizes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question