I think I have found the problem. Inside StdCmdCopy::activated/StdCmdPaste::activated the function sendMsgToFocusView() is called and when looking at its implementation shows why it fails in your case:
Code: Select all
bool Application::sendMsgToFocusView(const char* pMsg, const char** ppReturn)
{
MDIView* pView = getMainWindow()->activeWindow();
if(!pView)
return false;
for(auto focus=qApp->focusWidget();focus;focus=focus->parentWidget()) {
if(focus == pView) {
bool res = pView->onMsg(pMsg,ppReturn);
updateActions(true);
return res;
}
}
return false;
}
If you start the unit test then the dialog has the focus and because it's not a child of the MDI view the message will never be sent.
In the past we called the function sendMsgToActiveView() and realthunder has changed it with
git commit bd2f5191c9d3d3adfaf6. The commit message says:
send(Has)MsgToFocusView(), new API to send message to the active view
in focus. This is to solve the ambiguity of things like pressing
delete key, copy, paste handling when the active new is not in focus.
For example, when spread sheet view is active, delete/copy/paste
handling should be different when the focus on the spread sheet view
or focus on tree view.
So, to solve your problem you have several options:
- Try to make sure that the spreadsheet view has the focus
- Use the deprecated method Gui.SendMsgToActiveView
- The preferred way is to access the spreadsheet view and directly call the method to send the message. Unfortunately, this method is not yet visible in the Python wrapper. I will have a look at this...