title: Qt QActionGroup with QAction in toolbar
body: <p>I'm trying to make a QActionGroup with QAction buttons in a Toolbar made within the Designer mode.</p>
  <p>The goal is to make only one button being clicked. I followed this  example <a href="https://doc.qt.io/qt-5/qactiongroup.html#details" rel="nofollow noreferrer">https://doc.qt.io/qt-5/qactiongroup.html#details</a> but it doesn't make my buttons exclusive.
  I also tried to force
  <code> alignmentGroup.setExclusive(true);</code></p>
  <p>mainwindow.cpp, in MainWindow::MainWindow(QWidget *parent)</p>
  <pre><code>        alignmentGroup.addAction(ui-&gt;actionUsePointer);
          alignmentGroup.addAction(ui-&gt;actionMoveView);
          alignmentGroup.addAction(ui-&gt;actionEditText);
          ui-&gt;actionUsePointer-&gt;setChecked(true); 
  </code></pre>
  <p><a href="https://i.stack.imgur.com/St0EI.png" rel="nofollow noreferrer">my ui designer objects</a></p>
  <p>I followed the example but when I click on actionUsePointer for example, i can check all buttons without uncheck the first one...</p>
  <p><strong>EDIT</strong>
  Here is the mainwindow.ui</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ui version=&quot;4.0&quot;&gt;
   &lt;class&gt;MainWindow&lt;/class&gt;
   &lt;widget class=&quot;QMainWindow&quot; name=&quot;MainWindow&quot;&gt;
    &lt;property name=&quot;geometry&quot;&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;1098&lt;/width&gt;
      &lt;height&gt;815&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name=&quot;windowTitle&quot;&gt;
     &lt;string&gt;FSM Editor&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class=&quot;QWidget&quot; name=&quot;centralwidget&quot;&gt;
     &lt;layout class=&quot;QGridLayout&quot; name=&quot;gridLayout_2&quot;&gt;
      &lt;item row=&quot;1&quot; column=&quot;0&quot;&gt;
       &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout_4&quot;&gt;
        &lt;item&gt;
         &lt;widget class=&quot;QSplitter&quot; name=&quot;splitter&quot;&gt;
          &lt;property name=&quot;orientation&quot;&gt;
           &lt;enum&gt;Qt::Horizontal&lt;/enum&gt;
          &lt;/property&gt;
          &lt;widget class=&quot;QGraphicsView&quot; name=&quot;graphicsView&quot;&gt;
           &lt;property name=&quot;styleSheet&quot;&gt;
            &lt;string notr=&quot;true&quot;&gt;background-color:grey;&lt;/string&gt;
           &lt;/property&gt;
          &lt;/widget&gt;
          &lt;widget class=&quot;QTextBrowser&quot; name=&quot;textBrowser&quot;&gt;
           &lt;property name=&quot;maximumSize&quot;&gt;
            &lt;size&gt;
             &lt;width&gt;300&lt;/width&gt;
             &lt;height&gt;16777215&lt;/height&gt;
            &lt;/size&gt;
           &lt;/property&gt;
          &lt;/widget&gt;
         &lt;/widget&gt;
        &lt;/item&gt;
       &lt;/layout&gt;
      &lt;/item&gt;
     &lt;/layout&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QMenuBar&quot; name=&quot;menubar&quot;&gt;
     &lt;property name=&quot;geometry&quot;&gt;
      &lt;rect&gt;
       &lt;x&gt;0&lt;/x&gt;
       &lt;y&gt;0&lt;/y&gt;
       &lt;width&gt;1098&lt;/width&gt;
       &lt;height&gt;22&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
     &lt;property name=&quot;nativeMenuBar&quot;&gt;
      &lt;bool&gt;false&lt;/bool&gt;
     &lt;/property&gt;
     &lt;widget class=&quot;QMenu&quot; name=&quot;menuFichier&quot;&gt;
      &lt;property name=&quot;title&quot;&gt;
       &lt;string&gt;Fichier&lt;/string&gt;
      &lt;/property&gt;
      &lt;addaction name=&quot;actionOuvrir&quot;/&gt;
      &lt;addaction name=&quot;actionR_cemment_ouvert&quot;/&gt;
      &lt;addaction name=&quot;actionEnregistrer&quot;/&gt;
      &lt;addaction name=&quot;actionEnregistrer_sous&quot;/&gt;
     &lt;/widget&gt;
     &lt;widget class=&quot;QMenu&quot; name=&quot;menu_dition&quot;&gt;
      &lt;property name=&quot;title&quot;&gt;
       &lt;string&gt;Édition&lt;/string&gt;
      &lt;/property&gt;
      &lt;addaction name=&quot;actionAnnuler&quot;/&gt;
      &lt;addaction name=&quot;actionRevenir&quot;/&gt;
     &lt;/widget&gt;
     &lt;widget class=&quot;QMenu&quot; name=&quot;menuBackground&quot;&gt;
      &lt;property name=&quot;title&quot;&gt;
       &lt;string&gt;Background&lt;/string&gt;
      &lt;/property&gt;
      &lt;addaction name=&quot;actionAucun&quot;/&gt;
      &lt;addaction name=&quot;actionQuadrillage&quot;/&gt;
     &lt;/widget&gt;
     &lt;addaction name=&quot;menuFichier&quot;/&gt;
     &lt;addaction name=&quot;menu_dition&quot;/&gt;
     &lt;addaction name=&quot;menuBackground&quot;/&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QStatusBar&quot; name=&quot;statusbar&quot;/&gt;
    &lt;widget class=&quot;QToolBar&quot; name=&quot;toolBar&quot;&gt;
     &lt;property name=&quot;windowTitle&quot;&gt;
      &lt;string&gt;toolBar&lt;/string&gt;
     &lt;/property&gt;
     &lt;attribute name=&quot;toolBarArea&quot;&gt;
      &lt;enum&gt;TopToolBarArea&lt;/enum&gt;
     &lt;/attribute&gt;
     &lt;attribute name=&quot;toolBarBreak&quot;&gt;
      &lt;bool&gt;false&lt;/bool&gt;
     &lt;/attribute&gt;
     &lt;addaction name=&quot;actionUsePointer&quot;/&gt;
     &lt;addaction name=&quot;actionMoveView&quot;/&gt;
     &lt;addaction name=&quot;actionEditText&quot;/&gt;
     &lt;addaction name=&quot;separator&quot;/&gt;
     &lt;addaction name=&quot;actionShowEditor&quot;/&gt;
    &lt;/widget&gt;
    &lt;action name=&quot;actionOuvrir&quot;&gt;
     &lt;property name=&quot;icon&quot;&gt;
      &lt;iconset resource=&quot;icons.qrc&quot;&gt;
       &lt;normaloff&gt;:/img/folder-open.png&lt;/normaloff&gt;:/img/folder-open.png&lt;/iconset&gt;
     &lt;/property&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Ouvrir...&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionR_cemment_ouvert&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Récemment ouvert&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionEnregistrer&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Enregistrer&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionEnregistrer_sous&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Enregistrer sous&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionAnnuler&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Annuler&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionRevenir&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Revenir&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionUsePointer&quot;&gt;
     &lt;property name=&quot;checkable&quot;&gt;
      &lt;bool&gt;true&lt;/bool&gt;
     &lt;/property&gt;
     &lt;property name=&quot;enabled&quot;&gt;
      &lt;bool&gt;true&lt;/bool&gt;
     &lt;/property&gt;
     &lt;property name=&quot;icon&quot;&gt;
      &lt;iconset resource=&quot;icons.qrc&quot;&gt;
       &lt;normaloff&gt;:/img/mouse-pointer.png&lt;/normaloff&gt;:/img/mouse-pointer.png&lt;/iconset&gt;
     &lt;/property&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;UsePointer&lt;/string&gt;
     &lt;/property&gt;
     &lt;property name=&quot;iconVisibleInMenu&quot;&gt;
      &lt;bool&gt;true&lt;/bool&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionMoveView&quot;&gt;
     &lt;property name=&quot;checkable&quot;&gt;
      &lt;bool&gt;true&lt;/bool&gt;
     &lt;/property&gt;
     &lt;property name=&quot;icon&quot;&gt;
      &lt;iconset resource=&quot;icons.qrc&quot;&gt;
       &lt;normaloff&gt;:/img/arrows.png&lt;/normaloff&gt;:/img/arrows.png&lt;/iconset&gt;
     &lt;/property&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;moveView&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionEditText&quot;&gt;
     &lt;property name=&quot;checkable&quot;&gt;
      &lt;bool&gt;true&lt;/bool&gt;
     &lt;/property&gt;
     &lt;property name=&quot;icon&quot;&gt;
      &lt;iconset resource=&quot;icons.qrc&quot;&gt;
       &lt;normaloff&gt;:/img/i-cursor.png&lt;/normaloff&gt;:/img/i-cursor.png&lt;/iconset&gt;
     &lt;/property&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;EditText&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionAucun&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Aucun&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionQuadrillage&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Quadrillage&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
    &lt;action name=&quot;actionShowEditor&quot;&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Afficher l'XML&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
   &lt;/widget&gt;
   &lt;resources&gt;
    &lt;include location=&quot;icons.qrc&quot;/&gt;
   &lt;/resources&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>
  <p><strong>EDIT 2 :</strong>
  I'm not crazy, the action group feature is really missing from the Form Editor where it should be : <a href="https://forum.qt.io/topic/27282/qt-creator-2-7-x-creating-action-groups-in-form-editor/2" rel="nofollow noreferrer">https://forum.qt.io/topic/27282/qt-creator-2-7-x-creating-action-groups-in-form-editor/2</a></p>