Would it be possible to create a window with a webpage using a webkit component using QT4, then embed an OpenGL context into the middle in the same way a java applet or a flash applet may appear normally?
Sure, you can embed any QWidget into a web page shown through a QWebView, including a QGLWidget. This would be a starting point in the docs: http://doc.trolltech.com/4.5/qwebpage.html#setPluginFactory .
Related
I have a QtQuick QML application which is having a Window.
On the other hand, I am writing a separate QML plugin. This plugin has a Rectangle QML component. I would like to show this rectangle (i.e Load plugin) automatically when the application is started. I do not want to make changes to my QtQuick application. I just want to show rectangle on top of the QtQuick application as a overlay. How can this be achieved. Please advice!.
I tried many ways, but so far I can get this worked on a non EGLFS platform. But it does not seem to work on EGLFS platform. Request your recommendation. Thanks in advance!
Regards,
Kishore Ravikumar
I am new to QT Quick and QML and I am trying to build a Linux Desktop multi Window application using C++ and QT. I mean application having multiples windows like:
Slash or Welcome Screen
Main Dashboard
User Profile
Charts and Graphs
Etc. etc.
I want to have these screens as independent C++ classes and QML files for example:
Dashboard.cpp
Dashboard.qml
I am able to build QML files representing these screens but not sure how to map them to a class which will control and communicate with QML and backend. I want to have each QML file represented as C++ Class. And screen stack manager will use these classes to push and pop screens from the screen stack.
I have seen the examples provided by QT but most of the examples are single screen and not explaining how to have multiple screens and how the screen stack is maintained.
Use the Quick Controls 2 StackView control:
https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html
This control maintains a stack of QML views where the top one is always visible and you can pop and push views with animation.
I want to use Chromium Embedded Framework as GUI of my OpenGL application.
I am using Off-screen Rendering.
How to detect when a HTML button/link is clicked on?
I tried to google this but with so generic search term there is only noise.
The General Usage wiki also doesn't contain this.
I think you should catch an event in JS code and send a message to C++ code. It can be done using a message router described here:
https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage#markdown-header-asynchronous-javascript-bindings
It is also possible to implement a custom message router using JS integration mechanic:
https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
Do you pass any UI events to CEF from your OpenGL application?
In general you shall attach OpenGL and CEF instances to the same window. You shall also override request to invalidate window's area to notify your OpenGL code that it needs to rerender window including content of that on-screen buffer.
Sequence of actions:
Window receives mouse move event.
Window passes it to your CEF instance.
If CEF determines that it needs to apply :hover state to your button then it will call window.invalidateArea(areaOfTheButton).
You handle that window.invalidateArea() by updating OpenGL scene including new version of your off-screen bitmap.
From CEF you should also receive various secondary DOM events in response to mouse move/up/down/etc. on window.
And check this: http://sciter.com/sciter-and-directx/ - it is DirectX window with integrated HTML/CSS UI with my Sciter Engine. At the moment I am designing the same but for OpenGL.
I am making a windows application in which I need to initialize a OpenGL instance in a section of a QML window on clicking a button.
In Qt 5.5.0 there should be an example of what you are looking for. From the welcome screen in Qt Creator you should be able to switch to "Examples" tab, type "OpenGL" and find what you are looking for.
Here, as a part of Qt documentation, is explained how to render OpenGL scene in QML window:
Scene Graph - OpenGL Under QML
I'm trying to develop a cross platform (or at least desktop + embedded hardware) application. I would like to use Qt Quick to create a touch friendly GUI. I have been implemented a classical application with a QGLWidget displaying data. It is important that only a part of the window is in OpenGL. Because of this there are problems with EGLFS and LinuxFB. Only X11 (or maybe Wayland) can display the application properly (others generates a couple of errors about missing setParent function and the whole screen is black). Now I'm trying to achieve the same thing in QML. I want to use this OpenGL renderer as part of my QML application and some Qt Quick widgets around it. I found a couple of people asking about the same thing and the answer is always to subclass QDeclarativeItem and call the painter's beginNativePainting() (the others says to export it through QDeclarativeItem, but I cannot figure out how to do this). The problem is that on desktop, Qt 5.11 the native painter is not OpenGL. And in QT5 there is no way to force OpenGL graphics system. So when I try to get the OpenGL context (QGLContext::currentContext()) I always get NULL. Another problem: If I export my widget with qmlRegisterType("Test", 1, 0, "Test"); it becomes only visible when I use QDeclarativeView, but then it doesn't sees Qt Quick. If I use QQuickView it says module "Test" is not installed. How can I implement this properly?
QDeclarativeItem is from Qt Quick 1 and Qt4. With Qt 5 and Qt Quick 2 you should use QQuickItem.
There is at least 1 example of this provided with qt docs, which you can find in Qt Creator in the Welcome tab in the Examples section.