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 to adjust order of menu items?
Forum Updated to NodeBB v4.3 + New Features

How to adjust order of menu items?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.4k Views 1 Watching
  • 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.
  • jronaldJ Offline
    jronaldJ Offline
    jronald
    wrote on last edited by jronald
    #1

    For menu "recent files", if a path is already in the menu but not the first one, it should be move to the first.

    artwawA 1 Reply Last reply
    0
    • jronaldJ jronald

      @artwaw said in How to adjust order of menu items?:

      @jronald removeAction() and then insert it at the desired position?

      @JonB said in How to adjust order of menu items?:

      Since there is no "move", insert in desired order or use remove followed by re-insert if you have to move later on.

      Removing an action from menu will delete the action from memory, right?
      Then it needs to new an action and connect it with a handler, anyway to save this?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #7

      @jronald said in How to adjust order of menu items?:

      Removing an action from menu will delete the action from memory, right?

      No. Untested, but did you see void QWidget::removeAction(QAction *action), @artwaw suggested that too:

      Removes the action action from this widget's list of actions.

      I would expect it to preserve everything for re-insert. removeAction and insertAction reference each other.

      1 Reply Last reply
      3
      • jronaldJ jronald

        For menu "recent files", if a path is already in the menu but not the first one, it should be move to the first.

        artwawA Offline
        artwawA Offline
        artwaw
        wrote on last edited by
        #2

        @jronald you can use insertAction() method. When building your menu though it might be faster to sort your strings first and then build actions in the order of the strings.

        For more information please re-read.

        Kind Regards,
        Artur

        jronaldJ 1 Reply Last reply
        0
        • artwawA artwaw

          @jronald you can use insertAction() method. When building your menu though it might be faster to sort your strings first and then build actions in the order of the strings.

          jronaldJ Offline
          jronaldJ Offline
          jronald
          wrote on last edited by
          #3

          @artwaw said in How to adjust order of menu items?:

          @jronald you can use insertAction() method. When building your menu though it might be faster to sort your strings first and then build actions in the order of the strings.

          insertAction() can insert a new action, how to move an action?

          artwawA JonBJ 2 Replies Last reply
          0
          • jronaldJ jronald

            @artwaw said in How to adjust order of menu items?:

            @jronald you can use insertAction() method. When building your menu though it might be faster to sort your strings first and then build actions in the order of the strings.

            insertAction() can insert a new action, how to move an action?

            artwawA Offline
            artwawA Offline
            artwaw
            wrote on last edited by
            #4

            @jronald removeAction() and then insert it at the desired position?

            For more information please re-read.

            Kind Regards,
            Artur

            jronaldJ 1 Reply Last reply
            3
            • jronaldJ jronald

              @artwaw said in How to adjust order of menu items?:

              @jronald you can use insertAction() method. When building your menu though it might be faster to sort your strings first and then build actions in the order of the strings.

              insertAction() can insert a new action, how to move an action?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #5

              @jronald
              Since there is no "move", insert in desired order or use remove followed by re-insert if you have to move later on.

              1 Reply Last reply
              1
              • artwawA artwaw

                @jronald removeAction() and then insert it at the desired position?

                jronaldJ Offline
                jronaldJ Offline
                jronald
                wrote on last edited by
                #6

                @artwaw said in How to adjust order of menu items?:

                @jronald removeAction() and then insert it at the desired position?

                @JonB said in How to adjust order of menu items?:

                Since there is no "move", insert in desired order or use remove followed by re-insert if you have to move later on.

                Removing an action from menu will delete the action from memory, right?
                Then it needs to new an action and connect it with a handler, anyway to save this?

                JonBJ 1 Reply Last reply
                0
                • jronaldJ jronald

                  @artwaw said in How to adjust order of menu items?:

                  @jronald removeAction() and then insert it at the desired position?

                  @JonB said in How to adjust order of menu items?:

                  Since there is no "move", insert in desired order or use remove followed by re-insert if you have to move later on.

                  Removing an action from menu will delete the action from memory, right?
                  Then it needs to new an action and connect it with a handler, anyway to save this?

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #7

                  @jronald said in How to adjust order of menu items?:

                  Removing an action from menu will delete the action from memory, right?

                  No. Untested, but did you see void QWidget::removeAction(QAction *action), @artwaw suggested that too:

                  Removes the action action from this widget's list of actions.

                  I would expect it to preserve everything for re-insert. removeAction and insertAction reference each other.

                  1 Reply Last reply
                  3

                  • Login

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