I have a Qt function:
void MainWindow::button_clicked(Qstring a, Qstring b, Qstring c, Qstring d)
I collect data from QML and I want to pass data to this function which is in Qt. So I know I need to use Q_INVOKABLE
but don't know really how to use it.
And one more thing is it possible to invoke some other function when invoke this certain above.
For example: I invoke the above function but in her body I invoke refresh()
function. Is this possible?
QDeclarativeView *view= new QDeclarativeView; ui->setupUi(this); setCentralWidget(view); QDeclarativeContext *ctxt = view->rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(MainWindow::dataList)); view->setSource(QUrl("qrc:/gui.qml")); view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
so how to put your line inside? In main.cpp I only create mainwindow and call show method. – Alderman