]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction tab logic.
authornds <nds@opencascade.com>
Wed, 23 Dec 2015 13:35:09 +0000 (16:35 +0300)
committernds <nds@opencascade.com>
Thu, 24 Dec 2015 15:24:13 +0000 (18:24 +0300)
src/ModuleBase/ModuleBase_ToolBox.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/XGUI/XGUI_PropertyPanel.cpp

index 7f8736a250fb110f49948a9eecadd6d8778a42e5..592b5a0325847da1ed4abc4cb760e1f11cb7a7c5 100644 (file)
@@ -49,6 +49,7 @@ void ModuleBase_ToolBox::addItem( QWidget* thePage, const QString& theName, cons
   aButton->setIcon( theIcon );
   aButton->setIconSize( theIcon.size() );
   aButton->setToolTip( theName );
+  aButton->setObjectName( theName );
   myButtonsGroup->addButton( aButton, anOldCount );
   myButtonsLayout->insertWidget( anOldCount, aButton );
 }
index 95dfd185fde18a941bfab9e8e5a3c1cc04ddb9e4..40149e343af3eaa76486ab8e32c62541712a22ed 100755 (executable)
@@ -125,6 +125,9 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   }
 
   myListControl = new CustomListWidget(this);
+  QString anObjName = QString::fromStdString(attributeID());
+  myListControl->setObjectName(anObjName);
+
   aMainLay->addWidget(myListControl, 2, 0, 1, -1);
   aMainLay->setRowStretch(2, 1);
   //aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
index 47fc4b44c12474b84c49673fab4988121f6ac93b..4db52fd2a7171f6e309d193870a09856fa1c26cd 100644 (file)
@@ -81,6 +81,8 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen
 
   QString aToolTip = QString::fromStdString(theData->widgetTooltip());
   myTextLine = new QLineEdit(this);
+  QString anObjName = QString::fromStdString(attributeID());
+  myTextLine->setObjectName(anObjName);
   myTextLine->setReadOnly(true);
   myTextLine->setToolTip(aToolTip);
   myTextLine->installEventFilter(this);
index 413059e2ab41c545f4c3e723f52e43799ee7e2b8..1e61bf5e75edbbefb24728abb9597e805c916b51 100755 (executable)
@@ -181,12 +181,91 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget)
   activateWidget(NULL);
 }
 
+#ifdef DEBUG_TAB
+void findDirectChildren(QWidget* theParent, QList<QWidget*>& theWidgets, const bool theDebug)
+{
+  QList<QWidget*> aWidgets;
+
+  if (theParent) {
+    QLayout* aLayout = theParent->layout();
+    if (aLayout) {
+      for (int i = 0, aCount = aLayout->count(); i < aCount; i++) {
+        QLayoutItem* anItem = aLayout->itemAt(i);
+        QWidget* aWidget = anItem ? anItem->widget() : 0;
+        if (aWidget && aWidget->isVisible()) {
+          if (aWidget->focusPolicy() != Qt::NoFocus)
+            theWidgets.append(aWidget);
+          findDirectChildren(aWidget, theWidgets, false);
+        }
+        else {
+          if (aWidget) {
+            QString anInfo = QString("widget [%1] is visible = %2, nofocus policy = %3").arg(aWidget->objectName()).
+              arg(aWidget->isVisible()).arg(aWidget->focusPolicy() == Qt::NoFocus);
+            qDebug(anInfo.toStdString().c_str());
+          }
+        }
+      }
+    }
+  }
+  if (theDebug) {
+    QStringList aWidgetTypes;
+    QList<QWidget*>::const_iterator anIt =  theWidgets.begin(), aLast = theWidgets.end();
+    for (; anIt != aLast; anIt++) {
+      QWidget* aWidget = *anIt;
+      if (aWidget)
+        aWidgetTypes.append(aWidget->objectName());
+    }
+    QString anInfo = QString("theWidgets[%1]: %2").arg(theWidgets.count()).arg(aWidgetTypes.join(","));
+    qDebug(anInfo.toStdString().c_str());
+  }
+}
+
 bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
 {
   // it wraps the Tabs clicking to follow in the chain:
   // controls, last control, Apply, Cancel, first control, controls
+  bool isChangedFocus = false;
+
+  QWidget* aFocusWidget = focusWidget();
+  if (aFocusWidget) {
+    QString anInfo = QString("focus Widget: %1").arg(aFocusWidget->objectName());
+    qDebug(anInfo.toStdString().c_str());
+  }
 
+  QWidget* aNewFocusWidget = 0;
+  if (theIsNext) {
+    if (aFocusWidget) {
+      QList<QWidget*> aChildren;
+      findDirectChildren(this, aChildren, true);
+
+      int aChildrenCount = aChildren.count();
+      int aFocusWidgetIndex = aChildren.indexOf(aFocusWidget);
+      if (aFocusWidgetIndex >= 0) {
+        if (aFocusWidgetIndex == aChildrenCount-1) {
+          QToolButton* anOkBtn = findChild<QToolButton*>(PROP_PANEL_OK);
+          aNewFocusWidget = anOkBtn;
+        }
+        else {
+          aNewFocusWidget = aChildren[aFocusWidgetIndex+1];
+        }
+      }
+    }
+  }
+  else {
+  }
+  if (aNewFocusWidget) {
+    ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::focusNextPrevChild()");
+    isChangedFocus = true;
+  }
+  return isChangedFocus;
+}
+#else
+bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
+{
+  // it wraps the Tabs clicking to follow in the chain:
+  // controls, last control, Apply, Cancel, first control, controls
   bool isChangedFocus = false;
+
   if (theIsNext) { // forward by Tab
     QToolButton* aCancelBtn = findChild<QToolButton*>(PROP_PANEL_CANCEL);
     if (aCancelBtn->hasFocus()) {
@@ -235,10 +314,10 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
 
   if (!isChangedFocus)
     isChangedFocus = ModuleBase_IPropertyPanel::focusNextPrevChild(theIsNext);
-
   return isChangedFocus;
 }
 
+#endif
 void XGUI_PropertyPanel::activateNextWidget()
 {
   activateNextWidget(myActiveWidget);