Veteran C++ and C#/WinForms programmer here, getting familiar with Qt/QML.
There's a lot of information on how to call into C++ from QML, and I've got that working just fine, but I'd rather treat QML passively and manipulate it from C++ when at all possible.
For example:
frmLogin::frmLogin()
{
// Load QML file
// Wire up controls to their own pointers
cmdOK = QtQuick_GetControlFromQML("cmdOK");
cmdQuit = QtQuick_GetControlFromQML("cmdQuit");
}
void frmLogin::Show()
{
MyQMLPointerToWindow->Show();
}
void frmLogin::DoSomethingFromCPP()
{
cmdOK->SetProperty("text", "I just changed the button text");
rectBox->SetProperty("visible", true); // rectBox Rectangle from QML now appears on the screen
frmMainMenu = new frmMainMenu(); // Create new main menu window
frmMainMenu->ShowDialog(); // modal display
}
Is there a way to do this? Is it highly discouraged? I'm trying to make a multi-form modal application. It's difficult to find straightforward answers on all of this because it seems like QtQuick has gone through several design iterations. Any advice is appreciated!