diff libgui/graphics/Menu.cc @ 19967:3cc0734283dc

style fixes in Qt graphics code * Backend.cc, BaseControl.cc, ButtonControl.cc, Canvas.cc, CheckBoxControl.cc, Container.cc, ContextMenu.cc, EditControl.cc, Figure.cc, FigureWindow.cc, GLCanvas.cc, KeyMap.cc, ListBoxControl.cc, Logger.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc, ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, TextEdit.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, ToolBarButton.cc, __init_qt__.cc: Follow a few more Octave coding conventions.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Mar 2015 12:27:54 -0400
parents 2f4406e9dad6
children f0e61a67ad9f
line wrap: on
line diff
--- a/libgui/graphics/Menu.cc	Thu Mar 19 12:25:28 2015 -0400
+++ b/libgui/graphics/Menu.cc	Thu Mar 19 12:27:54 2015 -0400
@@ -36,7 +36,8 @@
 namespace QtHandles
 {
 
-static QKeySequence accelSequence (const uimenu::properties& up)
+static QKeySequence
+accelSequence (const uimenu::properties& up)
 {
   std::string s (up.get_accelerator ());
 
@@ -56,7 +57,8 @@
   return QKeySequence ();
 }
 
-Menu* Menu::create (const graphics_object& go)
+Menu*
+Menu::create (const graphics_object& go)
 {
   Object* parent_obj = Object::parentObject (go);
 
@@ -72,19 +74,22 @@
 }
 
 Menu::Menu (const graphics_object& go, QAction* action, Object* xparent)
-    : Object (go, action), m_parent (0), m_separator (0)
+  : Object (go, action), m_parent (0), m_separator (0)
 {
   uimenu::properties& up = properties<uimenu> ();
 
   action->setText (Utils::fromStdString (up.get_label ()));
+
   if (up.is_checked ())
     {
       action->setCheckable (true);
       action->setChecked (up.is_checked ());
     }
+
   action->setEnabled (up.is_enable ());
   action->setShortcut (accelSequence (up));
   action->setVisible (up.is_visible ());
+
   if (up.is_separator ())
     {
       m_separator = new QAction (action);
@@ -151,7 +156,8 @@
 {
 }
 
-void Menu::update (int pId)
+void
+Menu::update (int pId)
 {
   uimenu::properties& up = properties<uimenu> ();
   QAction* action = qWidget<QAction> ();
@@ -161,6 +167,7 @@
     case uimenu::properties::ID_LABEL:
       action->setText (Utils::fromStdString (up.get_label ()));
       break;
+
     case uimenu::properties::ID_CHECKED:
       if (up.is_checked ())
         {
@@ -173,13 +180,16 @@
           action->setCheckable (false);
         }
       break;
+
     case uimenu::properties::ID_ENABLE:
       action->setEnabled (up.is_enable ());
       break;
+
     case uimenu::properties::ID_ACCELERATOR:
       if (! action->menu ())
         action->setShortcut (accelSequence (up));
       break;
+
     case uimenu::properties::ID_SEPARATOR:
       if (up.is_separator ())
         {
@@ -199,48 +209,56 @@
           m_separator = 0;
         }
       break;
+
     case uimenu::properties::ID_VISIBLE:
       action->setVisible (up.is_visible ());
       if (m_separator)
         m_separator->setVisible (up.is_visible ());
       break;
+
     case uimenu::properties::ID_POSITION:
-      if (m_separator)
-        m_parent->removeAction (m_separator);
-      m_parent->removeAction (action);
-        {
-          int pos = static_cast<int> (up.get_position ());
-          QAction* before = 0;
+      {
+        if (m_separator)
+          m_parent->removeAction (m_separator);
+
+        m_parent->removeAction (action);
 
-          if (pos > 0)
-            {
-              int count = 0;
+        int pos = static_cast<int> (up.get_position ());
+        QAction* before = 0;
+
+        if (pos > 0)
+          {
+            int count = 0;
 
-              foreach (QAction* a, m_parent->actions ())
-                if (! a->isSeparator () && a->objectName () != "builtinMenu")
-                  {
-                    count++;
-                    if (pos <= count)
-                      {
-                        before = a;
-                        break;
-                      }
-                  }
-            }
+            foreach (QAction* a, m_parent->actions ())
+              if (! a->isSeparator () && a->objectName () != "builtinMenu")
+                {
+                  count++;
+                  if (pos <= count)
+                    {
+                      before = a;
+                      break;
+                    }
+                }
+          }
 
-          if (m_separator)
-            m_parent->insertAction (before, m_separator);
-          m_parent->insertAction (before, action);
-          updateSiblingPositions ();
-        }
+        if (m_separator)
+          m_parent->insertAction (before, m_separator);
+
+        m_parent->insertAction (before, action);
+
+        updateSiblingPositions ();
+      }
       break;
+
     default:
       Object::update (pId);
       break;
     }
 }
 
-QWidget* Menu::menu (void)
+QWidget*
+Menu::menu (void)
 {
   QAction* action = qWidget<QAction> ();
   QMenu* _menu = action->menu ();
@@ -257,7 +275,8 @@
   return _menu;
 }
 
-void Menu::actionTriggered (void)
+void
+Menu::actionTriggered (void)
 {
   QAction* action = qWidget<QAction> ();
 
@@ -266,12 +285,14 @@
   gh_manager::post_callback (m_handle, "callback");
 }
 
-void Menu::actionHovered (void)
+void
+Menu::actionHovered (void)
 {
   gh_manager::post_callback (m_handle, "callback");
 }
 
-void Menu::updateSiblingPositions (void)
+void
+Menu::updateSiblingPositions (void)
 {
   if (m_parent)
     {