Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Creator and QML Live Preview

Tags:

qt

qml

The problem now is that I don't know how I can use qml live preview? I saw a video: https://vimeo.com/145921618

I saw this post about erase this function for Qt Creator. How i can implementlive coding into my app?

like image 244
Jaime Asm Avatar asked Jan 22 '16 11:01

Jaime Asm


2 Answers

Perhaps you mean Terrarium?

Terrarium is a cross platform QML Playground: the view renders lively as you type in the editor, makes prototyping and experimenting with QtQuick a lot more fun!

It monitors changes in its TextEdit, and triggers the view to reload source from the local http server. If you're looking for a file system watcher implementation, please refer to QML LiveReload.

Or LiveReload?

like image 89
spring Avatar answered Sep 18 '22 02:09

spring


As is evident from the video, this is as simple as auto reloading a QML file each time a chance to the file has been saved.

You can easily do that yourself, set up a QFileSystemWatcher and every time the file is modified, load the file in a QML view. And there you have it.

Of course, this is only good for previewing standalone components which can work on their own. You could go further, set the file system watcher to monitor the entire QML project and reload the main QML file every time something changes. It is a two step process, you need to monitor the directory, which only reflects adding or removing of files, and you subsequently add or remove those files from watching for changes.

like image 30
dtech Avatar answered Sep 17 '22 02:09

dtech