Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QML realtime programming

I found a video which shows something which is called 'realtime programming' in the video.

This can be seen here.

I think the idea is to edit QML files while the applications is running. As soon as changes are saved the application shows this changes immediately.

This eliminates the need of restarting the application to see the changes.

I think this is really great because it speeds up the work flow.

But I don't really get it how this works. What do I have to do to make something like this works on a Windows environment?

like image 421
avb Avatar asked Mar 11 '14 08:03

avb


People also ask

Is QML a programming language?

QML is a user interface specification and programming language. It allows developers and designers alike to create highly performant, fluidly animated and visually appealing applications.

Is QML easy?

Coding with QML + JavaScript is very easy to learn and allows to reduce the required amount of code a lot. Language concepts like states, signals or property bindings are a huge time-saver. QML makes adding animations simple. You can animate every property of your QML types with simple Animation components.

Is C++ a QML?

QML is designed to be easily extensible through C++ code. The classes in the Qt QML module enable QML objects to be loaded and manipulated from C++, and the nature of QML engine's integration with Qt's meta object system enables C++ functionality to be invoked directly from QML.

Is QML similar to CSS?

QML (Qt Modeling Language) is a user interface markup language. It is a declarative language (similar to CSS and JSON) for designing user interface–centric applications.


1 Answers

See this answer on how to reload a QML file:

engine()->clearComponentCache();
setSource(source());

Now all you need to do is hook that up to a QFileSystemWatcher. Make QFileSystemWatcher watch your QML file, and when it changes, reload the view.

like image 156
Thomas McGuire Avatar answered Nov 15 '22 07:11

Thomas McGuire