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

Unsolved QWebEngineView closing

$
0
0

Hello,

I'm using a QWebEngineView inside a dylib library, to display an HTML page. Here a code extraction I used to create my View:

QWebEngineView *pView = new QWebEngineView();

OAuthUrlRequestInterceptor oauthInt(this, (clientSecret.size() > 0 ? code : implicit), "", pView);

pView->setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint);
pView->setWindowModality(Qt::ApplicationModal);
pView->setAttribute(Qt::WA_DeleteOnClose);

pView->page()->profile()->setRequestInterceptor(&oauthInt);

pView->resize(800, 600);

pView->load(QUrl(str));
pView->show();

while (true)
{
    if (oauthInt.isFinished() || !pView->isVisible())
        break;

    QApplication::processEvents(QEventLoop::AllEvents, 250);
}

pView->hide();
pView->close();
delete pView;

If the user close the View with close button, I have no problems. If I want to close the View programmatically, the window is closed too. I cannot close the application which is calling my dylib. Inside the OAuthUrlRequestInterceptor I recognize a specific URL, then the isFinished() method returns TRUE value, and I exit from the while loop. It seems that something is not correctly closed, or some events are not correctly catch and the application cannot be closed (the File Exit menu item is grayed). In both cases the QtWebEngineProcess is closed, but if the View is not closed with the Close system button I cannot close my application. I'm using QT 5.13 under MAC OS High Sierra.

Thanks
Giuseppe


Unsolved QT WebEngine devicemotion eventlistener - no values after init

$
0
0

Dear people,

i tried to load a - local html / a remote http and a https with webview, but the eventlistener never answered with values like event.acceleration.x. works with normal browser (https://timvolodine.github.io/deviceorientation-test/)

i tried with setHTML to add the eventlistener directly in WebEngineView but same result.

i trie to setAttributes but there is only one for geolocation. i need access to Gyroscope,Magnetometer and Accelerometer .

i tried to use arguments like --enable-web-security .. nothing changed

Is there a way not only to View HTML with the QT Library , but the integrated Javascript to?
window.addEventListener("devicemotion", handleOrientation,....
or something similar.

Maybe direct Gyroscope / Sensor access from Python? acceleration.x
Tried QAccelerometer() class but no chance

best regards and thanks

Python
PyQt5

Solved Crash when using qml webengineview

$
0
0

I wrote to chromium developers, so, here is the summary

It is not a crash, it is a failed debug assertion It happens if: you use webview's chromium backend (recent versions, old versions don't have this assertion) some part of you code consumes COM and that code's thread is not explicitly initializing COM via CoInitialize or CoInitializeEx

My code uses a library that was not properly initializing COM in its threads before calling CoCreateInstance. Calling CoInitialize should fix my issue, but I cannot prove it until I have access to that libraries source code.

What is left to be done by qt/webview team is to fix the failed assertion on "Chrome_InProcGpuThread" which is not created by user.

Unsolved Compilation problems

$
0
0

Hi,

I'm trying to compile Qt 5.12 with latest buildroot, but compilation ends up with such an error:

surface_factory_qt.cpp:(.text._ZN15QtWebEngineCore16SurfaceFactoryQtC2Ev+0x41): undefined reference to `vtable for ui::GLOzoneGLXQt'
collect2: error: ld returned 1 exit status
Makefile.core_module:85: recipe for target '../../lib/libQt5WebEngineCore.so.5.12.2' failed
make[5]: *** [../../lib/libQt5WebEngineCore.so.5.12.2] Error 1
Makefile:124: recipe for target 'sub-core_module-pro-make_first' failed
make[4]: *** [sub-core_module-pro-make_first] Error 2
Makefile:79: recipe for target 'sub-core-make_first' failed
make[3]: *** [sub-core-make_first] Error 2
Makefile:48: recipe for target 'sub-src-make_first' failed
make[2]: *** [sub-src-make_first] Error 2
package/pkg-generic.mk:238: recipe for target '/mnt/2tb/nerves/._nerves/rb/artifacts/rzjb_system_dev_beta-portable-1.0.0/build/qt5webengine-5.12.2/.stamp_built' failed
make[1]: *** [/mnt/2tb/nerves/._nerves/rb/artifacts/rzjb_system_dev_beta-portable-1.0.0/build/qt5webengine-5.12.2/.stamp_built] Error 2
Makefile:23: recipe for target '_all' failed
make: *** [_all] Error 2

I have no idea how I could try to fix this issue. Can anybody have a similar problem?

best regards,
Michał

Unsolved getUserMedia: User Media support is disabled

$
0
0

Hi all.

I have the Yocto BSP Linux image, based on boot2qt for the apalis-imx6 board. That image contains Qt 5.11.3 with EGLFS support (without of X11). Also I have the USB WEB-camera attached (it does work, as I checked it in gstreamer).

I have created a simple QML webengineview example (without of QtWidgets):

import QtQuick 2.0
import QtQuick.Window 2.0
import QtWebEngine 1.7

Window {
    width: 1024
    height: 750
    visible: true

    WebEngineView {
        id: view
        anchors.fill: parent
        url: "https://webrtc.github.io/samples/"

        onFeaturePermissionRequested: {
            console.log("onFeaturePermissionRequested");
            view.grantFeaturePermission(securityOrigin, feature, true);
        }

        onNewViewRequested: {
            console.log("onNewViewRequested");
            request.openIn(view)
        }
    }
}

But, when I do button click on the following url's: "Choose camera resolution"-> "HD" , it return an error:

getUserMedia: User Media support is disabled

which is displayed on a WebEngineView item.

I run my simple application from the root rights with this command line:

./myapp --no-sandbox

I looked the documentation API on the getUserMedia() that says:

SecurityError
User media support is disabled on the Document on which getUserMedia() was called. The mechanism by which user media support is enabled and disabled is left up to the individual user agent.

Also, I see that the onFeaturePermissionRequested() callback did not called (Also I have created a bug).

So, I don't understand, why this happens, because same example does work on Desktop Linux with same Qt 5.11.3 version

Unsolved Can't get QtWebEngine to work on Raspberry Pi 3B

$
0
0

Hello! I try to run the bare most sample of QtWebEngine on a Raspberry Pi using Yocto thud/warrior and EGLFS platform:

import QtQuick 2.0
import QtQuick.Window 2.0
import QtWebEngine 1.5

Window {
    width: 1024
    height: 750
    visible: true
    WebEngineView {
        anchors.fill: parent
        url: "https://www.qt.io"
    }
}

But I get this on stdout:

# QTWEBENGINE_DISABLE_SANDBOX=1 qmlscene -platform eglfs 123.qml
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
Sandboxing disabled by user.
Warning: Setting a new default format with a different version or profile after the global shared context is created may cause issues with context sharing.
Trace/breakpoint trap

And this on dmesg (a line on each attempt):

[ 2742.973347] Unhandled prefetch abort: breakpoint debug exception (0x002) at 0x7143f14a
[ 2776.056549] Unhandled prefetch abort: breakpoint debug exception (0x002) at 0x6fc3f14a
[ 3024.671555] Unhandled prefetch abort: breakpoint debug exception (0x002) at 0x6fc3f14a

I have gpu_mem=512 and I use userland drivers, not vc4. Had the very same issue with vc4graphics, though.

Unsolved Supporting dragging from a QWebEngineView to other QWidget in app

$
0
0

Hi all,

We are in the process of updating Qt from 5.4.1 to 5.12.3 and we stumbled upon some issue with dragging from a QWebEngineView to other QWidget. Our current approach was to create a QDrag that gets hooked into the webpage's document.onmousemove. This worked fine in Qt 5.4.1 but in 5.12.3 it seems to cause the QWebEngineView to freeze after a few drag and drop. A suspicion looking warning also started appearing after the Qt update:

"QDragManager::drag in possibly invalid state"

Digging into Qt's code, it seems there what looks like new code in QWebEnginePage that is handling drag and drop as well and that is creating a QDrag object of its own. I suspect this is what is causing the QWebEngineView to freeze. The rest of the application is still working though. Does anyone know much about the QWebEnginePage's drag and drop and if they have a preferred way in Qt 5.12.3 to handle dragging from QWebEngineView to other QWidget?

Unsolved QWebEngineView can not find javascript file in release but ok in Debug

$
0
0

Using googlemap with QWebEngineView, i would like to add myscript.js in the html file. It works very well in debug, but not in release. In release mode, myscript.js is not found with error js: Uncaught (in promise) ReferenceError: myscriptNameSpace is not defined

I'm working with Qt 5.12.2, MSVC 2017

my qrc file

<RCC>
    <qresource prefix="/">
        <file>html/googlemap.html</file>
        <file>js/myscript.js</file>
    </qresource>
</RCC>

my .h file

class GoogleMapWebEngine : public QWidget
{
    Q_OBJECT

public:
    explicit GoogleMapWebEngine(QWidget *parent = nullptr);
    virtual ~GoogleMapWebEngine() override;

protected:
    virtual void wheelEvent(QWheelEvent * event) override;

private:
    Ui::GoogleMapWebEngine *ui;
    QWebEngineView* m_webview;
    QWebChannel* m_webChannel;
};

my .cpp file

GoogleMapWebEngine::GoogleMapWebEngine(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GoogleMapWebEngine)
{
    qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "1234");
    ui->setupUi(this);

    m_webview = new QWebEngineView();
    m_webChannel = new QWebChannel();
    m_webChannel->registerObject("goolemainWindow", this);
    m_webview->page()->setWebChannel(m_webChannel);

    QUrl url = QUrl("qrc:/html/googlemap.html");
    m_webview->setUrl(url);
    ui->verticalLayout->addWidget(m_webview);
}

my googlemap.html file

<html>
    <head>
        ...
        <script src="qrc:/js/myscript.js"></script>

        <script type="text/javascript">           
            function initMap()
            {
                var
                    mapCenter = [32.794488, -96.780372],
                    mapOptions = {
                        zoom: 18,
                        center: new google.maps.LatLng(mapCenter[0], mapCenter[1]),
                        mapTypeId: google.maps.MapTypeId.SATELLITE

                    },
                    map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
                    myscriptNameSpace.test();
            }
        </script>        
    </head>

    <body ondragstart="return false">
        <div id="map-canvas" />
        <script async defer src="https://maps.googleapis.com/maps/api/js?key=myKey&callback=initMap"></script>
    </body>
</html>

myscript.js

var myscriptNameSpace = {}
myscriptNameSpace.test = function(){
    alert('test');
}

Expected : Alert messagae ‘test’ must be displayed

But have error in console in release : js: Uncaught (in promise) ReferenceError: myscriptNameSpace is not defined

My full source code is found here : github.com/hunglxtp/googlemapTest


Unsolved 泰国试管代孕包成功生男孩机构

$
0
0

供卵代孕【╇薇,電 137100乀97773】代生孩子★选性别包出生★试管包生男孩公司★供卵代孕包出生★代孕选性别生男孩★代生孩子价格★试管婴儿代孕★包出生包生男孩★代孕机构流程★中国黄(渤)海候鸟栖息地:被WWF列为“全球200佳”生态区域之一的黄海生态区,覆盖了包括 渤海、黄海和东海北部,水深不超过200米的海域,总面积46万平方公里,是一片生命供给的活野。。。
全球8条候鸟迁徒的路线中,东亚-澳大利亚迁飞区,横跨22个国家,每年250多个种群5000多万只水鸟穿越于不同纬度间,包括33种全球濒危物种和13种近危物种。。。

Unsolved 美国试管代孕包成功价格多少?

$
0
0

美国供卵代孕【╇薇,電 137100乀97773】代生孩子★选性别包出生★试管包生男孩公司★供卵代孕包出生★代孕选性别生男孩★代生孩子价格★试管婴儿代孕★包出生包生男孩★代孕机构流程★【英语启蒙+B-I-N-G-O】

这首经典的英文儿歌《Bingo》又好听又好唱:从前有个小农场,农场里有只小狗狗,它的名字叫做 BINGO,它每天开心地生活着~~~跟孩子一起学唱的时候,一定要配合韵律拍手哦,尤其是唱到“B-I-N-G-O”时,5个拍子要准才好玩!

附上歌词:

There was a farmer had a dog
And Bingo was his name-o
B I N G O
B I N G O
B I N G O
And Bingo was his name
There was a farmer had a dog
And Bingo was his name-o
I N G O
I N G O
I N G O
And Bingo was his name
There was a farmer had a dog
And Bingo was his name-o
N G O
N G O
N G O
And Bingo was his name
There was a farmer had a dog
And Bingo was his name-o
G O
G O
G O
And Bingo was his name
There was a farmer had a dog
And Bingo was his name-o
O
O
O
And Bingo was his name
There was a farmer had a dog
And Bingo was his name-o
And Bingo was his name-o

Unsolved Alternative of addToJavaScriptWindowObject in Qt 5.12.4

$
0
0

I am trying to migrate my code from QWebView to QWebEngine. I want to add an object from my code into the javascript. In QWebView it was possible with the function addToJavaScriptWindowObject. How can we do this in QWebEngine.

webview->page()->mainFrame()->addToJavaScriptWindowObject("qtObject", this);

Our java script need to call functions of "qtObject".

Unsolved Running Qt 5.12.3 QWebEngineView on windows 2008 server with Remote desktop fails

$
0
0

@sun708 One more difference i could find is, in case of failure, dwrite.dll that is loaded is of version 6.2.9200.22774. In case of success, its version is 6.2.9200.22164. Both of them are run on same machine.

Unsolved Windows 10 build qt webengine error, maybe because of some tools

$
0
0

I had install python 2.7.5 in tha path: C:\Python2, and I can excute python from windows cmd:
D:\qtwebengine>python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

quit
Use quit() or Ctrl-Z plus Return to exit

This is the -v parameter output log:
D:\qtwebengine>qmake D:\qtwebengine -- -webengine-proprietary-codecs -v
Command line: -webengine-proprietary-codecs -v

Running configuration tests...

Required bison could not be found.

Required flex could not be found.

Required gperf could not be found.

'python2.exe' not found in PATH. Checking for 'python.exe'.
Python version 3 is not supported by Chromium.
A suitable Python 2 executable could not be located.
Global lib dirs: [C:\opensslx86\lib C:\Utils\postgresqlx86\pgsql\lib] [D:\VS2015\VC\LIB\amd64 D:\VS2015\VC\ATLMFC\LIB\amd64 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64"]
Global inc dirs: [C:\opensslx86\include C:\Utils\postgresqlx86\pgsql\include] [D:\VS2015\VC\INCLUDE D:\VS2015\VC\ATLMFC\INCLUDE "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt"]

Why does 'python2.exe' not found in PATH ?

Unsolved QTWebEngine crashes on exit.

$
0
0

@hsynkrkmz
From posts I have seen elsewhere: this happens with QtWebEngine, sometimes. It seems to very picky about where it gets destroyed. If you are waiting for definitive answer, you might like to try moving around where/how you destroy it and see if different behaviour.

Unsolved How to get result from javascript code run by runJavaScript in QtWebengine?

$
0
0

How can I get the result from javascript run by runJavaScript in QtWebengine?

I want to get result from the js run by runJavaScript. The result is formed after some time in js, but since js returns immediately, I can not get the mature result. How can I modify the js code or the C++ code to get the mature result? I know I can use QWebChannel to notify C++ of the mature result at appropriate time but that is a little complex. Can I delay the return time of js code so it can return with the matured result?

C++:

page()->runJavaScript(js,[this](const QVariant &v) {
        qDebug()<<v.toString();
}

js:

var result="immature result";
function fun()
{
    result="mature result";
}
setTimeout(fun,2000);
result;

Unsolved Unable to get Inspect option in context menu in QWebEngineView.

Solved QtWebEngine signing issues

$
0
0

@krobinson thank you so much for taking the time to share your solution, this saved me a lot of headaches. I knew I'd probably need to add some entitlements to WebEngine, but I had no idea what.

Unsolved ES6 modules in QWebEnginePage?

$
0
0

@jsulm said in ES6 modules in QWebEnginePage?:

Where is _moduletesta.mjs located?

It's in Anki's collection.media folder, the only folder where Anki cards may load content from. Since it's the only content folder Anki allows, explicit paths are not needed. (I've verified with loading a non-module script and with CSS files, both of which are being loaded correctly.)

I've simplified the example somewhat, hopefully this makes things clearer. The example script in my OP should print 42 to the console, but it doesn't.

Edit: I've also tried importing from './_moduletesta.mjs' and '/_moduletesta.mjs', neither of which work.

Unsolved Qt 5.12.4 QtWebEngine crashes on view->load

$
0
0

Hello all,

I'm trying to run Qt5.12.4 on my IMX6 module.

A little background, my colleague got it to work on an older version of Qt v5.8 on pretty much the same IMX6 module. We built a custom Linux distro using buildroot, running kernel v4.1.15. All the application does is open up a webpage that we display on a screen. See below for the code snippet.

#include <QApplication>
#include <QWebEngineView>

int main(int argc, char *argv[])
{
    QApplication a (argc, argv);

    QWebEngineView* webView = new QWebEngineView();

    webView->setAttribute(Qt::WA_TranslucentBackground);
    webView->setStyleSheet("background::transparent");
    webView->page()->setBackgroundColor(Qt::transparent);
    printf("Loading URL...\n");
    webView->load(QUrl("http://localhost:3000"));
    printf("Loading done.\n");
    webView->show();

    return a.exec();
}

The IMX6 module we were previously using became obsolete so we had to upgrade to the vendor's latest module. Because of this change, we had to rebuild the kernel to support the new hardware. We're now running Kernel v4.9.x and Qt was updated to v5.12.4. I used Buildroot again to generate the Linux image and I matched the configuration from the previous build to this new one as best as I could. Because we updated Qt, I went back into Qt Creator and made sure the build environment matches the version of Qt that we built. Everything compiled just fine.

My issue: Now when executing the code on the target device, I get the error the following error:

[793:793:0802/122908.447886:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

When I add the --no-sandbox option, I get the following error.:

# ./qtWebpage_Linux4.9 --no-sandbox
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
 If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
[0802/123114.716409:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
[0802/123114.835285:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
Loading URL...
Unhandled prefetch abort: breakpoint debug exception (0x002) at 0x7250d830
Process ./qtWebpage_Linux4.9  got signal  5
stack trace:
  /lib/libc.so.6  :  __default_sa_restorer + 0
  /usr/lib/libQt5WebEngineCore.so.5  :   + 0x2228e88
  /usr/lib/libQt5WebEngineCore.so.5  :   + 0x2228eb8
  /usr/lib/libQt5WebEngineCore.so.5  :   + 0x2220048
  /usr/lib/libQt5WebEngineCore.so.5  :   + 0x17ae9a4
  /usr/lib/libQt5WebEngineCore.so.5  :   + 0x17af668
  /usr/lib/libQt5WebEngineCore.so.5  :  QtWebEngineCore::WebContentsAdapter::initialize(content::SiteInstance*) + 0x2dc
  /usr/lib/libQt5WebEngineCore.so.5  :  QtWebEngineCore::WebContentsAdapter::load(QWebEngineHttpRequest const&) + 0x63c
  /usr/lib/libQt5WebEngineCore.so.5  :  QtWebEngineCore::WebContentsAdapter::load(QUrl const&) + 0x34
  ./qtWebpage_Linux4.9() [0x1127c]
  /lib/libc.so.6  :  __libc_start_main + 0x110
Trace/breakpoint trap

It appears to break at the load function. I've contacted the vendor for support, but thought I'd ask here to see if anyone has had any similar issues.

Thank you all.

Unsolved QWebEngineView html images not displaying

$
0
0

(First use of QWebEngineView) After porting our Qt Widgets Windows desktop app to use QWebEngineView instead of QWebView for embedded help, the jpeg images are not displaying but everything else is looks good. Am I forgetting something?

images sit here:
C:\riverware\staff\rob2n\riverware-source\EngrObjs\release\embeddedHelp\rplFuncImages

baseUrl:
file:///riverware/staff/rob2n/riverware-source/EngrObjs/debug/embeddedHelp/RplFunctionDoc.html

html includes the following:
<td colspan="2">
<p>
<div style="width:10px;">
<img style="overflow:show;" id="imageAvgObjectsAggregatedOverTime" class="RplFunc_Image" alt="AvgObjectsAggregatedOverTime.jpg" src="rplFuncImages/AvgObjectsAggregatedOverTime.jpg"/>
</div>
</p>
</td>

line 'o code:
_ui._predefinedWebView->setHtml (htmlBytes, baseUrl);

screenshot:
0_1564781202409_8c12e908-28f5-4ad4-99bf-92b0549fabdb-image.png

Viewing all 13965 articles
Browse latest View live