PDA

View Full Version : Loading QDeclarativeView in QWebEngineView



ejoshva
6th May 2015, 12:22
I am porting from QGraphicsWebView to QWebEngineView.

There is QDeclarativeView above QGraphicsWebView meaning QGraphicsWebView is contained in QDeclarativeView.

I would like to know whether the same is possible (i.e.) loading QWebEngineView over QDeclarativeView.

https://wiki.qt.io/QtWebEnginePortingFromQtWebKit
QGraphicsWebView
Qt WebEngine requires hardware acceleration. Since we couldn't support a web view class in a QGraphicsView unless it is attached to a QGLWidget viewport, this feature is out of scope.

This is what I could find. I dont exactly understand what is conveyed in this link for QGraphicsView.

Kindly let me know if it's possible to load like that or any alternative is there.

The main idea behind using QDeclarativeView is to use QDeclarativeEngine and QDeclarativeContext to make use of the functions available in QDeclarativeView file in QML file.

Added after 1 8 minutes:

https://github.com/OtterBrowser/otter-browser/wiki/QtWebEngine-Wishlist

25. possibility to use within a QGraphicsView (without going through the need to use QGLWidget)

How this is done?

anda_skoa
6th May 2015, 12:33
The QtQuick part of QtWebEngine is based on QtQuick2, so that requires a QQuickView.

QDeclarativeView is QtQuick1, there is no QtWebEngine UI for that technology.

Cheers,
_

ejoshva
6th May 2015, 12:50
that means it can't be done ?

anda_skoa
6th May 2015, 15:23
As usual with software it doesn't mean that at all. It means it hasn't be done yet.

Any specific reason you need to stay with QtQuick1?

Cheers,
_

ejoshva
7th May 2015, 06:51
QDeclarativeEngine/QDeclarativeContext is made use of to set the context onto QML from CPP file.
That's why I am preferring.
Is there another way I can do this?

anda_skoa
7th May 2015, 07:07
That's not an answer of my question.
Why do you want to use QtQuick1 over QtQuick2?

QtWebEngine has existing UI for the latter.

Cheers,
_

ejoshva
7th May 2015, 07:16
The application has already been developed with QtQuick1 and QGraphicsView.
I am trying to port from QGraphicsWebView to QWebEngineView.

Being new to Qt, I didn't want to change much of existing functionality was written based on QtQuick and QGraphicsView.

Can I know how it's to be done with UI of QtWebEngine?

wysota
7th May 2015, 09:33
If you are new to Qt then porting QtWebEngine to QGraphicsView is definitely too difficult for you.

ejoshva
7th May 2015, 09:51
I am porting from QGraphicsView to QWebEngineView.

Added after 12 minutes:

http://doc.qt.io/qt-5/qtquick-porting-qt5.html#c-code
from this link I understand that QDeclarativeView is deprecated and QQuitView is used instead which is scenegraph oriented. So What I intended is this only.

When I include the <QtQml> or <QQuickView>
getting error as

In file included from ../ssparkl/readwidget.h:21:
In file included from /Applications/QT/5.4/clang_64/lib/QtQuick.framework/Headers/QQuickView:1:
In file included from /Applications/QT/5.4/clang_64/lib/QtQuick.framework/Versions/5/Headers/qquickview.h:37:
In file included from /Applications/QT/5.4/clang_64/lib/QtQuick.framework/Headers/qquickwindow.h:42:
/Applications/QT/5.4/clang_64/lib/QtQml.framework/Headers/qqml.h:62:5: error: redefinition of enumerator 'QML_HAS_ATTACHED_PROPERTIES'
QML_HAS_ATTACHED_PROPERTIES = 0x01

In file included from /Applications/QT/5.4/clang_64/lib/QtQuick.framework/Headers/QQuickView:1:
In file included from /Applications/QT/5.4/clang_64/lib/QtQuick.framework/Versions/5/Headers/qquickview.h:37:
In file included from /Applications/QT/5.4/clang_64/lib/QtQuick.framework/Headers/qquickwindow.h:42:
/Applications/QT/5.4/clang_64/lib/QtQml.framework/Headers/qqml.h:61:1: warning: declaration does not declare anything [-Wmissing-declarations]
enum { /* TYPEINFO flags */
^~~~
/Applications/QT/5.4/clang_64/lib/QtQml.framework/Headers/qqml.h:99:5: error: redefinition of 'qmlRegisterType'
int qmlRegisterType()

please help me resolve this.