how to connect QActions to SLOTS using qt designer

12,127

Solution 1

Look here in Docs Designer Connection Mode... How to autconnect in the designer

Solution 2

There's "Signal/Slot Editor" docked panel (Toggled with View->Signal/Slot Editor). You can connect your actions there. You may also need to add your custom slots via the "Change signals/slots" form context menu.

To save yourself some work, use the auto-connection feature (see QMetaObject::connectSlotsByName). Basically, all slots named with a specific pattern of on_objectName_signalName will be auto-connected.

Solution 3

Use the "Action editor" panel. You can find it near "Signals & Slots editor".

Share:
12,127
Dr Deo
Author by

Dr Deo

imagine if genes could be programmable. The language would probably be called cge (c for GEnes)

Updated on June 12, 2022

Comments

  • Dr Deo
    Dr Deo almost 2 years

    I have created a nice looking toolbar using qt Designer and populated it with some actions.
    I tried to connect the actions to slots visually from qt designer by clicking edit> signals and slots. This DID NOT WORK because i could not find any QAction signals.

    Question.

    Is there a way to connect the QAction SIGNAL(triggered()) to my slots within QT designer? Please help.
    PS: I am currently being forced to connect through code:

    QObject::connect(myAction, SIGNAL(triggered()),this, SLOT(myActionWasTriggered()))
    

    but ia am lazy and i wish to connect using qt designer.

  • Azd325
    Azd325 over 13 years
    then you can use the Autoconnect doc.trolltech.com/4.6.2/… ... with your source files
  • Dr Deo
    Dr Deo over 13 years
    When i try this on the toolbar, i see only the toolbars signals yet I am trying to connect QActions inside the toolbar to some slots. What i want is to see some actions and their signals within qt designer.