oauth2 setModifyParametersFunction post qt6
-
Hello Folks
Trying to update and compile some of my legacy apps using Qt 6.3.... come across a stumbling block.
any ideas on how to make this work on Qt6+ ?
oauth2->setModifyParametersFunction([](QAbstractOAuth::Stage stage, QVariantMap* parameters) { (*parameters)["redirect_uri"] = QUrl("https://localhost:1234"); });
works absolutly fine as as expected in Qt 5.15.2
however on Qt 6.3 erroring out with;
no viable conversion from lambda to 'const QAbstractOAuth::ModifyParametersFunction' (aka 'const function<void (QAbstractOAuth::Stage, QMultiMap<QString, QVariant> *)>')
Any clues on how to fix this, or is there another way to set redirect_uri on 6.3 ?
Thanks
Craig
-
Hello Folks
Trying to update and compile some of my legacy apps using Qt 6.3.... come across a stumbling block.
any ideas on how to make this work on Qt6+ ?
oauth2->setModifyParametersFunction([](QAbstractOAuth::Stage stage, QVariantMap* parameters) { (*parameters)["redirect_uri"] = QUrl("https://localhost:1234"); });
works absolutly fine as as expected in Qt 5.15.2
however on Qt 6.3 erroring out with;
no viable conversion from lambda to 'const QAbstractOAuth::ModifyParametersFunction' (aka 'const function<void (QAbstractOAuth::Stage, QMultiMap<QString, QVariant> *)>')
Any clues on how to fix this, or is there another way to set redirect_uri on 6.3 ?
Thanks
Craig
@testmonkey
Does changingQVariantMap* parameters
toQMultiMap<QString, QVariant>* parameters
fix this? -
brilliant thanks JonB; got me a step further....
error moved onto the next line;
error: No viable overloaded operator[] for type 'QMultiMap<QString, QVariant>'So I changed the code for insert instead. That function now works...
But looks like the urlrequestinterceptor is failing now... which is another error not relating to setModifyParametersFunction.
Probably something else changed in webengine
FATAL:navigation_url_loader_impl.cc(1114)] Check failed: parsed_headers.Equals(head->parsed_headers).
-
thanks again @JonB !
I have managed to get the app working.
For completeness;
I used to used to call a redirect in the requestinterceptor and link connect to the signal via --
connect(view, &QWebEngineView::urlChanged, view, &QWebEngineView::reload);in Qt 6.3 this was cause the QWebEnginePage::setUrlRequestInterceptor to backtrace and error out as mentioned with the parsed_headers.Equals error.
So after a bit of digging and a few qDebug decided to settle on creating and emitting the newurl instead and changed the connect to ;
connect(interceptor, &RequestInterceptor::newurl, view, &QWebEngineView::setUrl)