Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I can't recieve the changeEvent(QEvent* e) when I change the window state such as Qt::WindowMinimized and Qt::WindowMaximized.
Forum Updated to NodeBB v4.3 + New Features

I can't recieve the changeEvent(QEvent* e) when I change the window state such as Qt::WindowMinimized and Qt::WindowMaximized.

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 514 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Xu
    wrote on last edited by
    #1

    I have a custom widget that inherits from QMenuBar, and I have overridden the void changeEvent(QEvent* e) function. When I change the window state, such as maximizing or minimizing, the changeEvent(QEvent* e) is not being called. I believe this is not the expected behavior. Does anyone know why this is happening?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I don't see why change event should handle the window state according the doc: https://doc.qt.io/qt-6/qwidget.html#changeEvent

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      P 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        I don't see why change event should handle the window state according the doc: https://doc.qt.io/qt-6/qwidget.html#changeEvent

        P Offline
        P Offline
        Paul Xu
        wrote on last edited by Paul Xu
        #3

        @Christian-Ehrlicher

        Because the change events include QEvent::WindowStateChange and others. The window's states include minimized, maximized, or full-screen.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You are right - it's not sorted alphabetically.
          But QMenuBar will never be maximized - only your main window.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          P 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            You are right - it's not sorted alphabetically.
            But QMenuBar will never be maximized - only your main window.

            P Offline
            P Offline
            Paul Xu
            wrote on last edited by
            #5

            @Christian-Ehrlicher

            I originally intended to change some of the icons on the menu bar when the window was maximized or minimized...
            I have now achieved this through other means.

            jsulmJ 1 Reply Last reply
            0
            • P Paul Xu

              @Christian-Ehrlicher

              I originally intended to change some of the icons on the menu bar when the window was maximized or minimized...
              I have now achieved this through other means.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Paul-Xu said in I can't recieve the changeEvent(QEvent* e) when I change the window state such as Qt::WindowMinimized and Qt::WindowMaximized.:

              change some of the icons on the menu bar when the window was maximized or minimized

              But you can do that by listening to change event on your main window like @Christian-Ehrlicher wrote.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              P 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Paul-Xu said in I can't recieve the changeEvent(QEvent* e) when I change the window state such as Qt::WindowMinimized and Qt::WindowMaximized.:

                change some of the icons on the menu bar when the window was maximized or minimized

                But you can do that by listening to change event on your main window like @Christian-Ehrlicher wrote.

                P Offline
                P Offline
                Paul Xu
                wrote on last edited by
                #7

                But you can do that by listening to change event on your main window like @Christian-Ehrlicher wrote.

                @jsulm Yes.

                1 Reply Last reply
                0
                • P Paul Xu has marked this topic as solved on

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved