Uploaded image for project: 'Qt Creator'
  1. Qt Creator

Easier creation of slots for multiple widgets at once




      In the design view of creator, when you select a widget, you can choose "go to slot" from the context menu. This shows the slot dialog, generates the slot code if necessary, then switches to the code editor with the cursor at the slot function.

      However, in almost all cases – and I suspect I'm not alone – I've laid out multiple widgets on the GUI, and then have the intent to create slot handlers for most/all of them, then write the code.

      Currently, to do this, for each widget, I select "go to slot" and then immediately switch back to the design view and do the next widget. So if I have, say, 8 push buttons, the process for creating slots for all of them is:

      1. Right click the first one in design view.
      2. Select "go to slot"
      3. Select "clicked"
      4. Double-click the ui file in the project explorer to go back to design view
      5. Right click the second one
      6. Select "go to slot"
      7. Select "clicked"
      8. Double-click the ui file in the project explorer to go back to design view
      9. ...
      29. Right click the eighth one
      30. Select "go to slot"
      31. Select "clicked"
      32. Finished.

      It's so many repetitive steps. I'd really like an easier way to do this.

      To that end I have three alternate suggestions (open to more, as well):

      A) Add a "create slot" item to the widget context menu that shows the slot dialog and generates the code if necessary, but does not switch to code view, or
      B) Replace "OK" on the slot dialog with two buttons: "Go To" and "Create", where "Go To" is the current behavior and "Create" creates the slot but stays in design view, or
      C) The coolest option: If multiple widgets are selected and "go to slot" is chosen from the context menu, have the slot dialog display only the slots that are common to all of them, and on acceptance create the slot handlers for all of the selected widgets and switch to the code editor, with the cursor on one of the slot handlers (exactly which I'll leave as an exercise to the implementor).

      This would get rid of a ton of tedious, repetitive tasks that I perform many times in nearly every project.

      Note: Assuming there isn't some way to do this already that I just haven't discovered, of course! (I've wanted this for many years but I guess I got so used to the baseline level of suffering that I never bothered suggesting it. If it turns out there's a way to do it, I guess I'll just have to learn to live with the regret of losing so much of my life to double-clicking .ui files, )


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Unassigned Unassigned
            jasonc Jason Cipriani
            0 Vote for this issue
            1 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes