Quantcast
Channel: QtWebEngine
Viewing all 13965 articles
Browse latest View live

[[qanda:topic_unsolved]] qtWebengine Screen Capture API

$
0
0
@raven-worx Ok, thank you for reply. So I guess its not possible?

[[qanda:topic_unsolved]] How to generate translation file

$
0
0
Ignore the messages - it's coming from lupdate when it can't parse some code. The question is - is the ts file successfully created?

[[qanda:topic_unsolved]] QWebEngineUrlRequestInterceptor cause webview crash

$
0
0

Hi,
Today, I found my webView crashed the reason was because I delete QWebEngineUrlRequestInterceptor

my interceptor is:

#include "WebViewOrderInterceptor.h"

#include <QUrl>
#include <QUrlQuery>
#include <QDebug>

WebViewOrderInterceptor::WebViewOrderInterceptor(QObject *parent)
	: QWebEngineUrlRequestInterceptor(parent)
{

}

WebViewOrderInterceptor::~WebViewOrderInterceptor()
{
#ifdef QT_DEBUG
	qDebug() << __FUNCTION__;
#endif
}

void WebViewOrderInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
	QUrl url = info.requestUrl();

	if (url.path().contains("_____tmd_____/verify")) {
		emit verifyRequired();
	}
}

and the code where used interceptor is:

        WebViewOrderInterceptor* interceptor = new WebViewOrderInterceptor(webview);
	webView->page()->profile()->setRequestInterceptor(interceptor);

after I change the parent of interceptor from webview to 'this',
the webview did not crash,
but when i want to delete interceptor by calling interceptor->deleteLater() from 'this' Object after webview was closed and destoryed,
the crash happend again.

I noticed the document says

Registers a request interceptor singleton interceptor to intercept URL requests.

Does this means I just need only one interceptor for all webview.
And because of I build a interceptor for every webview, so when I delete interceptor, the webview will crash?

[[qanda:topic_unsolved]] How to run QtWebEngineProcess.app in Xcode debugger

$
0
0

I have a PyQt5 app that uses QWebEngineView (Qt 5.12.7 + PyQt 5.14.2). When running it on MacOS 10.15.4 via Xcode I see the following message in the Xcode debugger:

QtWebEngineProcess[44593:11856356] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x10c041010> (Domain: com.apple.universalaccess, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access

I guess that this is related somehow to entitlements but I can't find any information about how to enable these for debugging as all the available information seems to be related to signing for deployment.

What do I need to do to make this work for running it during development?

[[qanda:topic_unsolved]] PySide2 "Failed to parse extension manifest"

$
0
0

Re: [ERROR:extension_system_qt.cpp(122)] Failed to parse extension manifest.](/topic/110129/error-extension_system_qt-cpp-122-failed-to-parse-extension-manifest)

This error is caused when you have QT installed alongside PySide. I'm uncertain as to the complete nature of the bug, but it seems that having the QT paths alongside the PySide paths creates issues with some widgets and this is one example. Removing QT itself / the paths fixes this issue.

[[qanda:topic_unsolved]] ERROR:extension_system_qt.cpp(122)] Failed to parse extension manifest.

$
0
0
@v-n-lee See: https://forum.qt.io/topic/113413/pyside2-failed-to-parse-extension-manifest

[[qanda:topic_unsolved]] Segmentation Fault, PyQt5 Webdriver send_keys

$
0
0

Spent couple hours to try how to solve this problem, Using embeded QtWebEngine, instead of external browser, but when try to send_keys("some word") return "segmentation fault"

but its OK when send_keys without any string(send_keys("")), but its useless action

all webdriver action already under QThread

#!/usr/bin/python


import os
from PyQt5 import QtCore, QtGui, QtWidgets
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys

ADDRESS = '127.0.0.1'
PORT = '5558'
DEBUG_ADDRESS = ADDRESS + ':' + PORT
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = PORT

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(617, 395)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralWidget)
        self.gridLayout.setObjectName("gridLayout")
        self.webEngineView = QtWebEngineWidgets.QWebEngineView(self.centralWidget)
        self.webEngineView.setUrl(QtCore.QUrl("about:blank"))
        self.webEngineView.setObjectName("webEngineView")
        self.gridLayout.addWidget(self.webEngineView, 0, 0, 1, 1)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        spacerItem = QtWidgets.QSpacerItem(20, 340, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.pushButton = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton.setMaximumSize(QtCore.QSize(100, 16777215))
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout.addWidget(self.pushButton)
        self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralWidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        # load HTML
        HTML  = '<label>Please input some text</label><input type="text" name="q">'
        self.webEngineView.setHtml(HTML)

        #signal n slot
        self.pushButton.clicked.connect(self.pushButton_onClicked)

        # webdriver
        self.bot = None

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton.setText(_translate("MainWindow", "Fill Edit"))

    def driverResult(self, bot):
        if bot:
            self.bot = bot

            # execute
            self.executor = EXECUTOR(bot)
            self.executor.start()


    def pushButton_onClicked(self):
        if not self.bot:
            self.driver = WEBDRIVERBOT()
            self.driver.bot.connect(self.driverResult)
            self.driver.start()
        else:
            self.driverResult(self.bot)


class WEBDRIVERBOT(QtCore.QThread):
    bot = QtCore.pyqtSignal(object)
    def __init__(self):
        QtCore.QThread.__init__(self)

    def run(self):
            #setup browser
            options = Options()
            options.add_experimental_option("debuggerAddress", DEBUG_ADDRESS)
            desired_capabilities=options.to_capabilities()

            # connect browser
            try:
                driver = webdriver.Chrome(options=options, desired_capabilities=desired_capabilities)
                self.bot.emit(driver)
                print(driver)

            except Exception as error:
                print(error)
                self.bot.emit(None)

class EXECUTOR(QtCore.QThread):
    bot = QtCore.pyqtSignal(object)
    def __init__(self, bot):
        QtCore.QThread.__init__(self)
        self.bot = bot

    def run(self):
            try:
                self.elem = self.bot.find_element_by_name('q')
                print('after', 'find_element_by_name')

                # segmentation fault when excute this line
                self.elem.send_keys("hallo")
            except Exception as error:
                print(error)
                self.bot.emit(None)                


from PyQt5 import QtWebEngineWidgets


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    app.setApplicationDisplayName('Chrome')
    app.setApplicationVersion('80.0.3497.128')
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

if you try code above, save as Chrome(without ".py") and make it executable

[[qanda:topic_solved]] QtWebEngine signing issues

$
0
0
It's doesn't work form me, console output is: code object is not signed at all In subcomponent: Myapp/Contents/PlugIns/mediaservice/libqavfmediaplayer.dylib. but when i try sign with -deep, it's crash again.

[[qanda:topic_unsolved]] QtWebEngineProcess OSX codesign issues

[[qanda:topic_unsolved]] QWebEngineView not working on redirect urls

$
0
0

Hi,

I was trying the simplebrowser application provided in the Examples of QT 5.14.2 I changed the qt url in the code to shorturl.at/gEJS6 which is shortened for https://www.google.com but loading it takes forever. When i drag my mouse over the QWebEngineView then it loads, its just like refresh. Can someone check ?

[[qanda:topic_unsolved]] QWebEngineView does not work FORM METHOD='POST' ACTION OSX 10.14+

$
0
0

On OSX10.13 and previous and on Windows
App loads a local html file into a QWebEngineView.
Local page displays as expected.
There is a button to click defined with a FORM METHOD='POST' block
When the button is clicked, the loadProgress event fires
loadProgress reaches 100%
The loadFinished event fires when the secure form has loaded
The secure purchase form is loaded and displayed allowing user input

On OSX 10.14+
App loads a local html file into a QWebEngineView.
Local page displays as expected.
There is a button to click defined with a FORM METHOD='POST' block
When the button is clicked, the loadProgress event fires
loadProgress reaches 100%
The loadFinished event NEVER FIRES to indicate secure form has loaded
The secure purchase form is NOT DISPLAYED..JUST BLANK SCREEN

Manually loading the html file with any browseron both OSX10.13 and OSX10.14 works fine. Secure form is displayed when FORM METHOD='POST' button pressed for both OSes.

The above method has been working for 8 years. It has worked on QWebKit and QWebEngine until the release of OSX10.14.

What has changed to make QWebEngineView malfunction?

Does QWebEngineView not handle JS code when run on OSX10.14???

[[qanda:topic_unsolved]] Getting "Unknown module(s) in QT: webengine webenginewidgets " when trying to use it on Android

$
0
0
Maybe with QNetworkAccessManager

[[qanda:topic_unsolved]] Qt Webengine featurePermissionRequested signal not emitted

$
0
0

I am trying to load a page https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia which do WebRTC screen sharing,

And I have to apply permission to capture the desktop using the code

webPage->setFeaturePermission(QUrl(url), QWebEnginePage::DesktopVideoCapture, QWebEnginePage::PermissionGrantedByUser);

And the doc here https://doc.qt.io/qt-5/qwebenginepage.html#setFeaturePermission says I can call it when the signal featurePermissionRequested emitted. I have connect the signal with a slot but it's not getting called when I load the page.

I am getting following error when try to capture the screen

[2228:3460:0424/114301.567:INFO:CONSOLE(74)] "Start capturing.", source: https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/js/main.js (74)
js: Uncaught (in promise) NotAllowedError: Invalid state
[2228:3460:0424/114301.599:INFO:CONSOLE(99)] "Uncaught (in promise) NotAllowedError: Invalid state", source: https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/js/main.js (99)

Here is the code

    QString  url ="https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/";
    QWebEngineView *webEngineView =  new QWebEngineView(parent);
    webEngineView->load(QUrl(url));
    webEngineView->show();
    connect(webEngineView->page(), SIGNAL(featurePermissionRequested(const QUrl&, 
    QWebEnginePage::Feature)), this,SLOT(featurePermissionRequestedSlot(const QUrl&, QWebEnginePage::Feature)));

When I click start screen capture the slot featurePermissionRequestedSlot not called, what could be the reason.

[[qanda:topic_unsolved]] QWebEngineView error.

$
0
0

Hello,
I'm using QT 5.14.2 with MSVC 2017 and have installed and included QWebEngineView in the myproject.pro and as well as in mainwindow.h.

I also ran qmake QWebEngineView is showing up in auto completion as well.

But I get this error when I run the program.

:-1: error: No rule to make target 'D:/Qt/5.14.2/msvc2017_64/lib/libQt5WebEngineWidgetsd.a', needed by 'debug/WebApp.exe'. Stop.

Please Help Me Out!
Thanks.

[[qanda:topic_unsolved]] Trying to render a website on my program..

$
0
0
@U7Development said in Trying to render a website on my program..: QT += core gui sql webengine As shown in the documentation (https://doc.qt.io/qt-5/qwebengineview.html) it needs to be QT += core gui sql webenginewidgets

[[qanda:topic_unsolved]] QT HTTP client for upload file to server ?

$
0
0
@vikas-dhumal What is your question? To upload files do POST HTTP request. https://doc.qt.io/qt-5/qnetworkaccessmanager.html#post

[[qanda:topic_solved]] Should I build with OpenGL (desktop/dynamic) or not?

$
0
0
@gencer I also met this problem. but it not fall back to software opengl, it show black screen.

[[qanda:topic_unsolved]] Cannot sign in to google in QWebEngineView: This app may not be secure

$
0
0

I'm a beginner to QT and I recently developed a simple desktop browser using QWebEngineView to view the google search page. Everything works fine but when I enter my email to sign in to my google account, it Says,

Couldn't sign you in. This browser or app may not be secure. Learn more Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in.

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QWebEngineView>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QWebEngineView* google = new QWebEngineView(this);
    google->setUrl(QUrl("https://www.google.com/"));
    google->show();
    setCentralWidget(google);
}

MainWindow::~MainWindow()
{
    delete ui;
}

main.cpp

#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.setGeometry(100, 110, 800, 600);
    w.setWindowTitle("IBrowse");
    w.setWindowIcon(QIcon(":/new/prefix1/IBrowse.png"));
    w.showMaximized();
    return a.exec();
}

IBrowse.pro

QT       += core gui webengine webenginewidgets

RC_ICONS += IBrowse.ico

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h

FORMS += \
    mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    resources.qrc

How to fix this?.

Qt version = 5.14.2.

Compiler = MSVC 2017.

OS = Windows 10 64bit.

No errors in the console.

Thanks!!

[[qanda:topic_unsolved]] WebEngine - How to draw an animated SVG above a transparent web view?

$
0
0

On a Qt Quick interface, I need to show a complex animated SVG image. As the standard SVG module didn't support the SVG I want to show, I tried to use a WebEngineView as a component to achieve my drawing.

All works fine except that I cannot change the background color. I need my image to be shown above a colored background, however the image background is always white.

I tried the following code:

WebEngineView
{
    id: wvWebEngineView
    anchors.fill: parent
    backgroundColor: "transparent"
    url: "qrc:/Resources/Images/tbackupextractor/im-loading-animation.svg"
}

This resolve the transparency issue, however the background is no longer cleared, and this result to a completely insane drawing:
WebEngineSVG.png

So how can I both turn my page background transparent AND show an animated SVG on it?

[[qanda:topic_unsolved]] How to disable scrolling past the top/bottom/left/right in a QWebEngineView rendered page ?

Viewing all 13965 articles
Browse latest View live