Quenby (n.): A stubborn spot on a window which you spend twenty minutes trying to clean off before discovering it's on the other side of the glass.
This project implements a simple kiosk browser that starts off displaying a QWebEngineView widget that loads a given URL through a QWebEnginePage. Inside that page, the Javascript context is provided a QWebChannel interface that allows it to interface with the kiosk browser, open new widgets, make them load arbitrary URLs, receive callback if their URLs or HTML titles have changed etc.
$ ./quenby --help
Usage: ./quenby [options]
Simple kiosk browser
Options:
-h, --help Displays this help.
-w, --width Main web view width [default: 1280].
-i, --height Main web view height [default: 800].
-f, --fullscreen Fullscreen display [default: off].
-u, --url Default view URL [default: http://localhost:3000/dist].
-r, --remote-debug-port WebEngine debug port [default: 3002].
For a basic description of how to interface with a QWebChannel
interface, please refer to the
Qt WebChannel JavaScript API.
The parameter passed to new QWebChannel
should be qt.webChannelTransport
, and the channel returned from that callback function
can be used for the interaction.
In the main widget, the channel provides the following interface through the main
object.
All other widgets do not have access to this channel for now.
createWebView()
creates a new web widget and returns its numerical identifier which can be used later for referral.destroyWebView(index)
destroys a web widget that was previously created withcreateWebView()
, referenced by its index. All memory used by the widget is freed, and the widget is removed from the screen.setWebViewUrl(index, url)
sets the URL of the web widget with indexindex
tourl
.setWebViewGeometry(index, x, y, w, h)
sets the geometry of the web widget with indexindex
to the givenx
andy
positions and to heighth
and widthw
.setWebViewVisible(index, visible)
sets the visibility of the web widget with indexindex
to visible (true
) or invisible (false
), as given by thevisible
parameter.setWebViewTransparentBackground(index, transparent)
makes the background of web widget with indexindex
either transparent (true
) or opaque (false
), as given by thetransparent
parameter.
onWebViewURLChanged(index, url)
is fired whenever the web widget with indexindex
has changed its current URL. The new URL is passed in the paremeterurl
.onWebViewTitleChanged(index, title)
is fired whenever the web widget with indexindex
has changed its current HTML page title. The new title is passed in the paremetertitle
.onWebViewLoadProgressChanged(index, value)
is fired whenever the web widget with indexindex
changed its loading progress. The current progress is reported in the parametervalue
, in percentage.
Web page debugging is enabled when the target is built in debug mode. Use a Chromium based web browser and point it to
http://localhost:3002
while the application is running. You can override the default port with the --debug
command line switch.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this software; If not, see http://www.gnu.org/licenses/.