Starting an external application from QML - qt

Is it possible to run an external application ( a .exe file ) from a QML file? I know that I can use Qt+QML and QProcess class but suppose that I only can access the QML file and can't recompile the c++/Qt part( Actually this project is a QML+Qt project)

If you can't access your C++ code, I'm afraid you can't.
There is an old open issue (2010) about this, but it seems it hasn't been considered a lot.
Anyway, it would be really easy if you could add something like this simple plugin to your project (but this would require rebuilding it).

Related

Qt Creator and QML Live Preview

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?
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?
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.
Just for the sake of it, I want to share another tool that I found online.
It is a web based QML editor that gives immediate preview while writing the code. It has its limits, but still it's pretty useful for live QML coding
https://qmlweb.github.io/
If someone is still interested, in my Qt 5.10 installation, there is a qmlscene.exe in bin folder (same location as qmake or assistant). Running on command line is fine, however it is not in Qt creator.
PS: I found this:
http://doc.qt.io/qt-5/qtquick-qmlscene.html

QGraphicsItem does not show

I wrote a simple application that displays QGraphicsPixmapItems in a QGraphicsScene. The application should be portable without installing Qt on the operating system. I managed to copy only the needed dll files to start the application. Everything works except the QGraphicsItems are not displayed at all, although they are in the scene (wrote a logfile that counts the items).
I figured out that the items are shown correctly, if I copy my "portable" exe file into Qt\Qt5.2.1\5.2.1\mingw48_32\bin folder.
The opposite does not work: If I copy all of the bin-folder to my portable application folder, it does not work. How can I use a QGraphicsItem in a portable Qt application?
you might miss a plugin for the images you want to display.
make sure your application directory looks like this:
<root>
- <executable>
- <imageformats>
- <used image libraries>
I found the reason: I needed to add the folder Qt\Qt5.2.1\5.2.1\mingw48_32\plugins\imageformats to my "portable-app"-folder. In particular, the needed dll was qjpeg.dll.

Does Qt Resources system support having files just for testing?

I already used the Resources from Qt to add a couple of icons to the menu and works great, but now I was wondering if it would be possible to add a file that I need to use as a reference for testing purposes.
Therefore, I would like this file to be accesible just when I´m running the tests, not that it gets added to the binary of the application. Is there any way to set that differentiation?
I did not find something like that in Qt´s documentation.
You can do it programmatically using QResource.
Or maybe writing on the .pro file (i have not tried it!! ) :
Debug:RESOURCES += resources_only_debug_mode.qrc
more information here : Qt .pro Docs

Convert Multiple SWF files to Single EXE

Hi I have an application in flash, I build in ActionScript 3.0 Flash IDE, my application loads some external swfs which mentioned via XML file. Its working fine at the moment. But I need to compile all these external SWFs and xml file into single exe file. How can I compile like this. or how can I code like this?
EDIT: 1
from here : http://page-flip.com/products/pdf-publisher/
You can see an example, the application is build in .net and it import pdf and publish it as flash projector or web based(swf). How is it compiling all the external SWF files.
If you have Flash CS4 you can make use of the mxmlc compiler which has some additional tricks up it's sleeve.
Using the embed tag like this will allow you to embed an entire swf "inside" your swf:
[Embed(source = '../assets/items/9.swf')] public static const ITEM_9:Class;
Then, to instantiate it you simply go:
var mySprite:Sprite = new ITEM_9() as Sprite;
Using this and some clever overloading of your current classes for external loading should allow you to get a single swf (xml files can be embedded in a similar fashion).
Then it's just a matter of using the Publish settings to make Flash spit out an .exe
On an unrelated note, please go back and accept some answers to your questions. It's not very nice not to.
You can try mdm Zinc.
Zinc is really powerful. It lets you package your Flash or Flex in different ways, with lots of native platform hooks.
you can build an AIR application. if you don`t want it to be cross platform, you can build an AIR application with a windows native installer.
Flash > File > Project settings > Windows Projector.
For MAC, choose a MAC projector.
If you are burning to a disc and you need both platforms to work...a good option is to use Toast (if you are on a MAC)...it will hide the files you don't need the user to see, and also hide windows files from MACs and vice versa.
There is an application for Windows called SWFKit, which allows you to package your SWF and external files into one exe file. I had the same problem as you, and this worked a treat for me. Unfortunately you do need to pay for it :( http://www.swfkit.com
Hope this helps,
Will
I would go about it with these steps
create a flex application
embed all of the SWF's and the XML into that application
create a release of the application you just created
open the SWF application with the stand-alone flash player and not with the browser
from the file menu select the option create projector
All of this will result a single EXE file that contains all of the SWF's and the XML file.
You can use a projector or make an windows only AIR project.
Use flajector and forget about your problems

Link an external library at runtime in .NET

Is it possible for my application to monitor a folder that if we copy a DLL (library) in it, the application will pick it up and link it?
I did a similar thing in C++ back in the days but is it possible to dynamically link a library in .NET?
Thanks
Using reflection you could.
Poll the directory for added files, and then if you find one, load it using reflection and run some Main method inside it.
However you can't "unload" these DLLs unless they are loaded into seperate AppDomains.
Absolutely. See this SO question or consider using the MEF.

Resources