Skip to content
  • 0 Votes
    9 Posts
    1k Views
    D

    @hskoglund I confirm that this works nicely. Thanks!

  • 0 Votes
    6 Posts
    651 Views
    PhoenoxP

    @Pl45m4 I thought as much. As to the question how the app should know: Well, the window manager knows, and Qt should be my adapter to the system's window manager. But I do agree that it's something one doesn't need very often.

    I've now implemented a workaround: I've subclassed the QQuickView and connect a slot to the following signals:

    QWindow::xChanged() QWindow::yChanged() QWindow::widthChanged() QWindow::heightChanged()

    In the slot, I first check if the window is in maximized state. If not, I store the current window geometry.
    When persisting the window state, I store the geometry stored in this subclass, not the one returned by QWindow::geometry().

    When I restore, I can first set the geometry and then open it in maximized state. When I now unmaximize it, I get desired geometry.

    In any case, thanks for helping me out and confirming that this cannot be accessed directly through Qt's interface.

  • 0 Votes
    5 Posts
    3k Views
    A

    @marcbf said in Remember window size before maximization (or Detect if QResizeEvent is maximization):

    int w = currentSize.width();
    int h = currentSize.height();

    if (restoresize)
    {
    w = qMax(settings["Width"].Value(0), w);
    h = qMax(settings["Height"].Value(0), h);
    }

    Man, this is the deal!!! Everything worked perfectly after I fine tuned your code to my context! Thank you very much.

    The trick was really to use normalGeometry and windowState, so these two are the answer to my question.

  • 0 Votes
    4 Posts
    3k Views
    ValentinMicheletV

    @Wilk said:

    The reason that it did not work with QMainWindow or QWidget is that those classes does not implement fullScreen as full featured property - it can not be set with setFullScreen() slot.

    I see, thanks for the precision.

    @Wilk said:

    Thanks alot

    No problem, I hope your bug report will be helpful for other people.