void activateWindow(QWidget* theWidget, const QString& theInfo)
{
- theWidget->activateWindow();
+ if (theWidget) {
+ theWidget->activateWindow();
+ theWidget->raise();
+ }
#ifdef DEBUG_ACTIVATE_WINDOW
qDebug(QString("activateWindow: %1").arg(theInfo).toStdString().c_str());
void setFocus(QWidget* theWidget, const QString& theInfo)
{
+ activateWindow(theWidget);
theWidget->setFocus();
-
+ // rectangle of focus is not visible on tool button widgets
+ theWidget->repaint();
#ifdef DEBUG_SET_FOCUS
qDebug(QString("setFocus: %1").arg(theInfo).toStdString().c_str());
#endif
else
storeValue();
}
+ ModuleBase_Tools::setFocus(mySpinBox, "ModuleBase_WidgetEditor::editedValue");
+ mySpinBox->selectAll();
if (theSendSignals && !myIsEditing)
emit enterClicked(this);
QToolButton* anOkBtn =
dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_OK);
if (anOkBtn)
- anOkBtn->setFocus(Qt::TabFocusReason);
+ ModuleBase_Tools::setFocus(anOkBtn, "XGUI_PropertyPanel::activateNextWidget");
}
}
}
#include <QTimer>
#include <QMenu>
+//#define SALOME_PATCH_FOR_CTRL_WHEEL
extern "C" {
SHAPERGUI_EXPORT CAM_Module* createModule()
OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
SHAPERGUI_OCCSelector* aSelector = new SHAPERGUI_OCCSelector(aViewer,
getApp()->selectionMgr());
+#ifdef SALOME_PATCH_FOR_CTRL_WHEEL
+ aViewer->setUseLocalSelection(true);
+#endif
LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
QList<SUIT_Selector*> aList;
aMgr->selectors(aList);
#include <QMouseEvent>
#include <QContextMenuEvent>
+//#define SALOME_PATCH_FOR_CTRL_WHEEL
+
SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer* theViewer)
: ModuleBase_IViewWindow(), myCurrentView(0)
{
if (!mySelector || !mySelector->viewer())
return;
SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+#ifdef SALOME_PATCH_FOR_CTRL_WHEEL
+ OCCViewer_Viewer* aViewer = dynamic_cast<OCCViewer_Viewer*>(aMgr->getViewModel());
+ if (aViewer)
+ aViewer->setUseLocalSelection(toActivate);
+#endif
QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
if (toActivate) {
foreach (SUIT_ViewWindow* aView, aViews) {
refresh();
if (!isVisible()) {
show();
- raise();
ModuleBase_Tools::activateWindow(this, "XGUI_ErrorDialog::addError");
}
}
isAccepted = myOperationMgr->onProcessDelete(theObject);
break;
default:
- myOperationMgr->onKeyReleased(theObject, aKeyEvent);
- isAccepted = true;
+ isAccepted = myOperationMgr->onKeyReleased(theObject, aKeyEvent);
break;
}
}
if (aOperation) {
ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
if (aPanel) {
- // check for case when the operation is started but property panel is not filled
- XGUI_PropertyPanel* aPP = dynamic_cast<XGUI_PropertyPanel*>(aPanel);
- aPP->focusNextPrevChild_(theEvent->key() == Qt::Key_Tab);
- isAccepted = true;
+ QWidget* aFocusedWidget = qApp->focusWidget();
+ bool isPPChildObject = aFocusedWidget && isChildObject(aFocusedWidget, aPanel);
+ if (!isPPChildObject) {
+ // check for case when the operation is started but property panel is not filled
+ XGUI_PropertyPanel* aPP = dynamic_cast<XGUI_PropertyPanel*>(aPanel);
+ aPP->setFocusNextPrevChild(theEvent->key() == Qt::Key_Tab);
+ isAccepted = true;
+ }
}
}
}
aNewFocusWidget = aCancelBtn;
}
if (aNewFocusWidget)
- aNewFocusWidget->setFocus(Qt::TabFocusReason);
+ ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::activateNextWidget");
activateWidget(NULL);
}
#endif
}
-bool XGUI_PropertyPanel::focusNextPrevChild_(bool theIsNext)
+bool XGUI_PropertyPanel::setFocusNextPrevChild(bool theIsNext)
+{
+ return focusNextPrevChild(theIsNext);
+}
+
+bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext)
{
// it wraps the Tabs clicking to follow in the chain:
// controls, last control, Apply, Cancel, first control, controls
}
// we want to have property panel as an active window to enter values in double control
- ModuleBase_Tools::activateWindow(this, "XGUI_PropertyPanel::activateNextWidget()");
ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::focusNextPrevChild()");
ModuleBase_ModelWidget* aNewFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this,
/// \return button instance or NULL
QToolButton* findButton(const char* theInternalName) const;
+ /// Possibility to process focus by method, for example when Tab or SHIF+Tab is pressed
+ /// but property panel is not active widget
+ /// \param theIsNext true, if Tab(to the next widget) or false(moving to the previous)
+ bool setFocusNextPrevChild(bool theIsNext);
+
public slots:
/// \brief Update all widgets in property panel with values from the given feature
/// \param theFeature a Feature to update values in widgets
/// Makes the widget active, deactivate the previous, activate and hightlight the given one
/// \param theWidget a widget
bool setActiveWidget(ModuleBase_ModelWidget* theWidget);
-public:
/// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
/// Emits a signal about focus change
/// If theIsNext is true, this function searches forward, if next is false, it searches backward.
- virtual bool focusNextPrevChild_(bool theIsNext);
-protected:
- virtual bool focusNextPrevChild(bool theIsNext) { return true; }
+ virtual bool focusNextPrevChild(bool theIsNext);
/// Activate the next widget in the property panel
/// \param theWidget a widget. The next widget should be activated
/// \param isCheckVisibility flag whether the next widget visibility is checked
// in order to operation manager could process key events of the panel.
// otherwise they are ignored. It happens only if the same(activateWindow) is
// not happened by property panel activation(e.g. resume operation of Sketch)
- ModuleBase_Tools::activateWindow(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
ModuleBase_Tools::setFocus(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
}
// are processed by this console. For example Undo actions.
// It is possible that this code is to be moved to SHAPER package
QMainWindow* aDesktop = desktop();
- ModuleBase_Tools::activateWindow(aDesktop, "XGUI_Workshop::hidePropertyPanel()");
ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::showPropertyPanel()");
}