Skip to content

Add windowGeometryChanged to QMainWindowSignals to track window changes. #384

Open
@pro100andrik

Description

@pro100andrik

Is your feature request related to a problem? Please describe.
I want to control window size and position changes to store them and when app close and starts again, read that geometry and show the window at the same size and coordinates when it was closed.

Describe the solution you'd like
I think adding windowGeometryChanged method for QMainWindowSignals will be a perfect solution to this issue. When window changes its geometry, this signal will be fired and will return Geometry

Describe alternatives you've considered
After reading the documentation and looking through the issues in this repository, I didn't find such a signal, so I came up with this solution

const mainWindowRef = useRef(null)
const handleMainWindowChange = useEventHandler({
  Resize: () => {
    console.log(mainWindowRef.current.native.size().height())
    console.log(mainWindowRef.current.native.size().width())
  },
  Move: () => {
    console.log(mainWindowRef.current.native.pos())
  }
}, [mainWindowRef])
<Window
  ref={mainWindowRef}
  on={handleMainWindowChange}
>
</Window>

Additional context
Maybe I have missed something in documentation, let me know what.

Activity

sedwards2009

sedwards2009 commented on Nov 13, 2023

@sedwards2009

I catch the same events in my app for the same purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sedwards2009@pro100andrik

        Issue actions

          Add windowGeometryChanged to QMainWindowSignals to track window changes. · Issue #384 · nodegui/react-nodegui