C++ (Qt)connect(ui->preview,SIGNAL(urlChanged(QUrl)),this,SLOT(check_url(QUrl,QString,QString)));
C++ (Qt)connect(ui->preview,SIGNAL(urlChanged(QUrl)),this,SLOT(check_url(QUrl))); и void vkapiwin::check_url(QUrl url) { url = url.toString().replace("#","?"); this->token = QUrlQuery(url).queryItemValue("access_token"); this->id = QUrlQuery(url).queryItemValue("user_id");}
C++ (Qt)#include <QtCore>#include <QtGui>#include <QtWidgets>#include <QWebEngineView> class A : public QObject{ Q_OBJECT public slots: void printUrl(const QUrl &url) { qDebug() << "from A:" << url; }}; int main(int argc, char *argv[]){ QApplication app(argc, argv); QWebEngineView w; A a; QObject::connect(&w, SIGNAL(urlChanged(QUrl)), &a, SLOT(printUrl(QUrl))); QObject::connect(&w, &QWebEngineView::urlChanged, [](const QUrl &url){ qDebug() << "from lambda:" << url; }); w.load(QUrl("https://oauth.vk.com/authorize?client_id=5681259&display=mobile&redirect_uri=https://oauth.vk.com/blank.html&scope=friends&response_type=token&v=5.60&state=123456")); w.show(); return app.exec();} #include "main.moc"