Qt 6.11 is out! See what's new in the release
blog
WebEngine FileDialog Request accept dialog
-
I searched in qt sources and in 'qquickwebenginedialogrequests.cpp' file i found this functions :
void QQuickWebEngineFileDialogRequest::dialogAccept(const QStringList &files) { m_accepted = true; QSharedPointer<FilePickerController> controller = m_controller.toStrongRef(); if (controller) controller->accepted(files); } void QQuickWebEngineFileDialogRequest::dialogReject() { m_accepted = true; QSharedPointer<FilePickerController> controller = m_controller.toStrongRef(); if (controller) controller->rejected(); }I can reject WebEngineView file dialog launched by file dialog request by calling this:
QMetaObject::invokeMethod(upload, "dialogReject");But i don't know how to accept that,
I triedQMetaObject::invokeMethod(upload, "dialogAccept",Q_ARG(QString,path));but didn't worked.
What should I do? -
I searched in qt sources and in 'qquickwebenginedialogrequests.cpp' file i found this functions :
void QQuickWebEngineFileDialogRequest::dialogAccept(const QStringList &files) { m_accepted = true; QSharedPointer<FilePickerController> controller = m_controller.toStrongRef(); if (controller) controller->accepted(files); } void QQuickWebEngineFileDialogRequest::dialogReject() { m_accepted = true; QSharedPointer<FilePickerController> controller = m_controller.toStrongRef(); if (controller) controller->rejected(); }I can reject WebEngineView file dialog launched by file dialog request by calling this:
QMetaObject::invokeMethod(upload, "dialogReject");But i don't know how to accept that,
I triedQMetaObject::invokeMethod(upload, "dialogAccept",Q_ARG(QString,path));but didn't worked.
What should I do?@mmjvox said in WebEngine FileDialog Request accept dialog:
QString,path
It needs to be QStringList, not QString:
QStringList paths; paths << path; QMetaObject::invokeMethod(upload, "dialogAccept",Q_ARG(QStringList,paths));