Tag Archives: planetkde

QmlWeb is not dead

It’s been 363 days now, since I last blogged about QmlWeb here. I hope to find more time to develop and blog about it, but for now just a quick note to let you all know, QmlWeb is still alive. Development is moving slower than I would wish, but it is moving.

QmlWeb based MineHunter

A minesweeper game running in the webbrowser using QmlWeb.

Maybe you can already guess, why I am writing this. Right. I plan to go to Randa in August, in order to continue feature development and for looking into some possible real-world applications of QmlWeb. And we are raising money for that. For me as a student if I can go there actually does depend on whether we gain enough money or not.

Tomorrow (2014-07-09) is the last day of the fundraising campaign, so if you are interested in supporting my work on QmlWeb, please click here and donate whatever you can and will, in order to make the Randa development sprint possible – every euro or dollar (or money of any other currency) does make a difference.

Thank you :)

About QmlWeb:

QML consists out of an easy declarative syntax plus JavaScript. QtQuick uses a scenegraph to render the UI. A webbrowser implements JavaScript and a scenegraph to render UIs. QmlWeb is the bridge between those worlds: It’s a library, purely written in JavaScript itself, that implements a full QML engine and QtQuick libraries and uses the browser’s technologies to execute JavaScript and render QtQuick-UIs into the webbrowser.

With property bindings and anchor layouting, it already brings most of the convinience of QML to the web development world. Nevertheless, it still has a long way to go, until it’s ready for production. With your help (may it be financial or by contributing) we are able to go that long way.


WebApps written in QML: Not far from Reality anymore

Have you ever tried to vertically center an element using CSS or wanted an element to just use the whole remaining space or similar things? Did you ever struggle with complex interfaces when writing a modern website? Did you ever use QML for a desktop-app and were in wonder how amazingly it just works? Then there probably was also the point where you thought “why can’t I just use QML for my webapp?”. So have I.

And in fact it is nearer to reality than you would think: Say hello to QmlWeb.

QmlWeb is a JavaScript library that is able to parse QML-code and create a website out of it using normal HTML/DOM elements and absolute positions within CSS, translating the QML properties into CSS properties. Currently it’s also able to paint into a canvas but as canvas is far less powerful, that’s probably going to be dropped. So using the DOM-backend there is no need for HTML5. The webbrowser needs to support ECMAScript5 for now, though.
QmlWeb is a small project by Lauri Paimen that he’s already developing for a few years now. In the last months, I entered into the development refactoring parts of the library, so by now Lauri yielded the maintainance to me. The biggest part of the credits, though, are due to him.

As of today, I’m proud to announce that QmlWeb will be from now on a KDE-Project.

(A small prototype of a website for QmlWeb – of course written using QML 😉 )

QmlWeb of course doesn’t yet support everything Qt’s implementation of QML does, but it already supports a quite usable subset of it. It supports nearly all of the most basic QML syntax. The element types it supports, are

  • Item
  • Rectangle
  • Text
  • Image
  • BorderImage
  • MouseArea
  • Repeater
  • ListModel
  • NumberAnimation
  • SequentialAnimation

Moreover it has support for HTML input elements (Button, TextInput, TextArea are currently supported, more to come).
Positioning using anchors works like a charm, Components work too, so does the signal-slot system. Basic animations work nicely (Animations in QML are most probably far more powerful, but what works in QmlWeb is already quite nice :) ). Keyboard-control is missing as well as States. Layouts (Row, Column, etc.) are currently under development.

Of course there are many more little features missing, but the library is already quite usable. In fact I’m already using it for one webapp, I’m currently writing. There are some places where I’m still using direct html/css, but that’s another nice feature of QmlWeb. You can easily integrate it with normal html/css: QmlWeb exposes the element-id to css-classes, so you can easily include a stylesheet in your surrounding html-file and set all css-properties, you can’t control (yet) with QML, to your QML-element.

That’s soooo awesome! How can I use it?

Just grab the latest code from git://anongit.kde.org/qmlweb, put the qmlweb folder in the same directory like your webpage and put the following code into your index.html:

[code lang=”html”]
<!DOCTYPE html>
<title>QmlWeb Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../qmlweb/src/parser.js"></script>
<script type="text/javascript" src="../qmlweb/src/process.js"></script>
<script type="text/javascript" src="../qmlweb/src/import.js"></script>
<script type="text/javascript" src="../qmlweb/src/qtcore.js"></script>
<body style="margin: 0;">
<script type="text/javascript">
var qmlEngine = new QMLEngine();

Then add a file main.qml containing your QML-coded website. (Tip: use “anchors.fill: parent” in your root element to use the whole size of the inner window)

But it can’t do XYZ!!

Well, QmlWeb is not finished, yet. And I’m looking for people willing to help. :)
Just grab the code, fix it and join our mailinglist <this project’s name>@kde.org, join us on #kde-qmlweb on Freenode/irc or get in touch with me, directly: <my nick>@web.de (btw. the project’s name is qmlweb and my nick is akreuzkamp 😉 )

I'm going to Akademy 2013! :)

Edit: I added information about how it renders QML to websites (QmlWeb is using normal HTML/DOM elements and absolute positions within CSS, translating the QML properties into CSS properties to paint elements).

Edit2: I corrected the code example, added a tip how to use the full window size and added information about the mailinglist and irc-channel.

Rethinking Virtual Desktops

First of all: This is my first blog-post on planetkde. So I’ll introduce myself:
My name is Anton Kreuzkamp, I am 15 years old and am from Germany (near Frankfurt). I am using KDE for about 3 years now and am developer for about 1½ years. I’m kind of a migrant worker in KDE, I do some feature here, some patch there, but no fix project (so far I’ve contributed to Plasma, KWin and Rekonq but I have plans for Calligra, Kontact and other projects as well).

So let’s come to the real topic of this post.
There were times when people used virtual desktops (VD) to seperate their different activities on the computer. Now KDE has Activities ‒ a much more powerful way to seperate different tasks than VD. So why do we still need virtual desktops? Why do we have two different concepts doing the same? The answer is easy and has been given a dozen times before: Because they are NOT the same, but are made for different kind of tasks. Activities are about… well, activities, a logical separation of different tasks. VD are about extending the available space of  the desktop, where the windows are to many to fit on the screen nicely.

I have never used VD. My windows use to be more than half of my screen in size, so I can’t have multiple windows shown completely on the screen, and even VD don’t help there. But wouldn’t it be nice if you could combine the free space of two virtual desktops? Then a window would fit in that space. But of course you can’t have one half of a window on one VD and the other half on the another VD and still use it. So I implemented this idea in form of a kwin effect:
The Workspace Strap
The Workspace Strap Effect
It allows you to organize your windows on a linear strap, either horizontally or vertically, that supports stepless scrolling. When you press Alt+Meta (configurable) you get a preview of the strap (see above) and can easily scroll by dragging.

But as a picture says more than 1000 words and a screencast is made of a thousand pictures, here’s one for explanation:


This implementation is just a kind of experiment to see whether it’s a satisfying experience, to integrate it upstream, it will probably need to be rewritten deeper in Kwin (like virtual desktops or window tiling), but if it’s coming over well I will try to find the time for it.

The code can be found at kde-apps.org or in my personal scratch-repo: git://anongit.kde.org/scratch/akreuzkamp/workspacestrap.git

I appreciate feedback of all kinds.
Have fun.

PS: I tried half a dozen screencast applications and none of it worked. I finally managed to make the screencast using an application not made for taking screencasts but to display videos: VLC media player. Real time encoding, full HD-quality with 20fps, no performance regressions (on my machine), without crashes. Thanks a lot to the VLC team.