Hi everybody,
In my Qt project, i use QML for design my GUI. My program have a mainform and a number of .qml GUI file. When i want to show a QML form, i link the mainform.cpp --> to the .QML GUI file respectively.

here is my code

formmain.h

Qt Code:
  1. Q_INVOKABLE void configuration() { displayForm("qrc:/UI/frmconfiguration.qml");}
  2. Q_INVOKABLE void mainScreen() { displayForm("qrc:/UI/frmmain.qml");}
  3. void displayForm(QString qmlFile)
  4. {
  5. QDeclarativeView* pView = loadForm(qmlFile);
  6. setCentralWidget(pView);
  7. pView->setFocus();
  8. }
To copy to clipboard, switch view to plain text mode 


formain.cpp
Qt Code:
  1. QDeclarativeView* FrmMain::loadForm(QString qmlFile)
  2. {
  3. QDeclarativeView* pDeclarative = new QDeclarativeView(QUrl(qmlFile));
  4. pDeclarative->setResizeMode(QDeclarativeView::SizeRootObjectToView);
  5. pDeclarative->rootContext()->setContextProperty("navigator",this);
  6. return pDeclarative;
  7. }
To copy to clipboard, switch view to plain text mode 

in the .QML GUI form, when an event buttonpressed occur, the navigator is called. For example when i'm in formmain and button Configuration is pressed, something like below is carry out :

Qt Code:
  1. Keys.onEnterPressed : navigator.frmconfiguration()
To copy to clipboard, switch view to plain text mode 

But the problem here is : when i press button Configuration and switch to new Configuration GUI form, the system doesn't focus to this new form unless i use mouse to click on this new form ( Configuration Form )

This bug is very critical for my project , so could anybody help me fix this bug i'm very respected for your help

sincerely