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. How I can override the minimize button?

How I can override the minimize button?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 3.1k 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.
  • mandruk1331M Offline
    mandruk1331M Offline
    mandruk1331
    wrote on last edited by
    #1

    I know that I can override the closeEvent slot, but is there's a slot smth like minimizeEvent?

    Mandruk1331

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2
      void MainWindow::changeEvent(QEvent *event)
      {
          if (event->type() == QEvent::WindowStateChange)
          {
              if (isMinimized()){
                  // it was minimised
      }
              else{
                  // it's normal or maximised
      }
          }
       
          return QMainWindow::changeEvent(event);
      }
      

      source: https://forum.qt.io/topic/20243/solved-minimize-event/13

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      mandruk1331M 1 Reply Last reply
      2
      • VRoninV VRonin
        void MainWindow::changeEvent(QEvent *event)
        {
            if (event->type() == QEvent::WindowStateChange)
            {
                if (isMinimized()){
                    // it was minimised
        }
                else{
                    // it's normal or maximised
        }
            }
         
            return QMainWindow::changeEvent(event);
        }
        

        source: https://forum.qt.io/topic/20243/solved-minimize-event/13

        mandruk1331M Offline
        mandruk1331M Offline
        mandruk1331
        wrote on last edited by
        #3

        @VRonin Thank you.

        Mandruk1331

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          If your issue is solved please mark the topic as solved, see https://forum.qt.io/topic/71830/hitchhiker-s-visual-guide-to-the-qt-forum

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          mandruk1331M 1 Reply Last reply
          1
          • VRoninV VRonin

            If your issue is solved please mark the topic as solved, see https://forum.qt.io/topic/71830/hitchhiker-s-visual-guide-to-the-qt-forum

            mandruk1331M Offline
            mandruk1331M Offline
            mandruk1331
            wrote on last edited by
            #5

            @VRonin Just one more thing, is there a way I can make a sliding-out menu, like there will be a button >> and when I press it a menu slides out?
            P.S. without using QML

            Mandruk1331

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              http://doc.qt.io/qt-5/qtoolbutton.html with setMenu()

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              mandruk1331M 1 Reply Last reply
              0
              • VRoninV VRonin

                http://doc.qt.io/qt-5/qtoolbutton.html with setMenu()

                mandruk1331M Offline
                mandruk1331M Offline
                mandruk1331
                wrote on last edited by
                #7

                @VRonin https://blog.kitware.com/give-your-cute-qt-gui-some-pop/
                I want to have smth like this, can I achieve this using the qtoolButton?

                Mandruk1331

                1 Reply Last reply
                0
                • VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by VRonin
                  #8

                  You have to reimplement the display of the "menu" (actually a widget) so might as well use a QPushButton directly. going off topic a lot here

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  1 Reply Last reply
                  0

                  • Login

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