I can't get it to work I still have the activeSubWindow error.openBrain wrote: ↑Thu Jan 27, 2022 3:44 pmSomething like :Code: Select all
QMdiArea *mdi = qobject_cast<QMdiArea *>( Gui::MainWindow::getInstance()->centralWidget()->activeSubWindow()); if (!mdi) return; mdi->activeSubWindow()->widget()->setFocus();
This is purpose of setFocus(). I tested above method in Python (no need to cast ) and works.But maybe I'm not asking the correct question actually.
What I need is to give the keyboard events back to ViewProviderSketch. I'm not sure that what I need is to give focus to the main window. What do you think?
However I tested and found that the
Code: Select all
Gui::MDIView* mdi = Gui::Application::Instance->activeDocument()->getActiveMainView();
mdi->setFocus();
Yet even if I don't use the space key to change constraint mode, once the focus is given back to that mdi, the space key goes nuts and does the sketch visibility on/off.