tools/designer/src/lib/shared/qdesigner_menu.cpp
changeset 33 3e2da88830cd
parent 18 2f34d5167611
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    75 
    75 
    76 // give the user a little more space to click on the sub menu rectangle
    76 // give the user a little more space to click on the sub menu rectangle
    77 static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir)
    77 static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir)
    78 {
    78 {
    79     switch (dir) {
    79     switch (dir) {
       
    80     case Qt::LayoutDirectionAuto: // Should never happen
    80     case Qt::LeftToRight:
    81     case Qt::LeftToRight:
    81         subMenuRect->setLeft(subMenuRect->left() - 20);
    82         subMenuRect->setLeft(subMenuRect->left() - 20);
    82         break;
    83         break;
    83     case Qt::RightToLeft:
    84     case Qt::RightToLeft:
    84         subMenuRect->setRight(subMenuRect->right() + 20);
    85         subMenuRect->setRight(subMenuRect->right() + 20);
   929         return;
   930         return;
   930     }
   931     }
   931 
   932 
   932     if (ctrl)
   933     if (ctrl)
   933         (void) swap(m_currentIndex, m_currentIndex - 1);
   934         (void) swap(m_currentIndex, m_currentIndex - 1);
   934 
   935     --m_currentIndex;
   935     m_currentIndex = qMax(0, --m_currentIndex);
   936     m_currentIndex = qMax(0, m_currentIndex);
   936     // Always re-select, swapping destroys order
   937     // Always re-select, swapping destroys order
   937     update();
   938     update();
   938     selectCurrentAction();
   939     selectCurrentAction();
   939 }
   940 }
   940 
   941 
   945     }
   946     }
   946 
   947 
   947     if (ctrl)
   948     if (ctrl)
   948         (void) swap(m_currentIndex + 1, m_currentIndex);
   949         (void) swap(m_currentIndex + 1, m_currentIndex);
   949 
   950 
   950     m_currentIndex = qMin(actions().count() - 1, ++m_currentIndex);
   951     ++m_currentIndex;
       
   952     m_currentIndex = qMin(actions().count() - 1, m_currentIndex);
   951     update();
   953     update();
   952     if (!ctrl)
   954     if (!ctrl)
   953         selectCurrentAction();
   955         selectCurrentAction();
   954 }
   956 }
   955 
   957