I'm new to Qt, all the development we have done so far for our UI project is using qml.
When I release this project to somebody who don't have Qt installed I'm sharing the .qml files as well (when packaging the exe).
Is there a method/process to share a qt exe without sharing the .qml files?
I assume you have your QML files outside of the app and you load them something like this:
QQuickView view;
view.setSource(QUrl::fromLocalFile("application.qml"));
view.show();
if you want to integrate your QML files directly in code and hide them from users you should use Qt Resource System. Add Qt Resource file to your project and pack all your QML files into it. You can then use them in your app like this:
QQuickView view;
view.setSource(QUrl("qrc:/application.qml"));
view.show();
More info about Deploying QML Applications you can read here
Related
I made a simple qt widget application using visual studio there were UI form files which I can open and edit UI in qt designer, now I want to shift to qml, I made a new qtquick application but I cannot find any qml.ui files.
What You are talking about is QT Quick UI Form which has the extension ui.qml. This ui.qml file is not "bundled" together with a new Qt Quick Project. You Can take a look for Yourself in the Qt Creator:
Go to: File -> New File or Project
Under the Projects section there is an option that You have probably chosen: Application (Qt Quick) which creates a new application
Under the Files and Classes section there is an option Qt and then You can choose to create the file You were looking for: QtQuick UI File:
As You can see, it says that it creates the form as a ui.qml file, that You can later add to an existing Qt Quick Project.
This is why You can't find the file with the form - You have to create it separately.
I have a QML, OpenCV application on qt5 which uses qmake and has a .pro file. I want to add publishers/subscribers to my qt project to publish video stream and instructions etc. I tried to use catkin_create_qt_pkg command to create a template and transfer my project to the template but there were numerous problems which made me question my approach. The ros-qt template uses Cmakelist and .ui instead of qml. So, I will need to change some things to integrate them.
First, is it possible to use ros with qmake and .pro instead of cmake. It would be easier to add just ros publishers and listeners to my existing application than changing the entire QML application. If not, how do I convert qmake and .pro to cmake and Cmakelist.txt (assuming that I can use QML with ros). Also, although it doesn't sound well, is it possible to use .pro for qt and Cmakelist.txt for ros in the same package?
Second, is it safe to use qt5 and qml with ros? The ros_qt app template uses qt4, not qt5. Here is the app template.
I'm using Qt 5.5 to create a small app. In the app, I'm manually creating a component like so:
QQmlComponent component(engine, QUrl("qrc:/Box.qml"));
assert(component.isReady());
My .qrc file IS included in the .pro file like so:
RESOURCES += qml.qrc
All works well when I run from Qt creator. However, when I deploy the app using the macdeployqt tool and try to run the app I get that assert hit. Sure enough, I tried to put a loop around the .isReady() and it will hang forever.
What is the proper way for doing this? My qml component is working fine when in the Qt creator, so why does it fail in deployment?
Thanks
This turned out to be simple. You need to pass -qmldir=<path to your qml files> to macdeployqt. It is actually required if you have QML files but I somehow didn't see it in the documentation.
please note that I am not a native in English. sorry for any mistake.
I am very new to QT(just started yesterday) and have only few experiences with MFC.
I want to know how to integrate QT GUI DLL into non QT application.
I made this QT GUI DLL from the wizard: I simply chosen QT Gui Application and in .pro I changed "TEMPLATE = app" to "TEMPLATE = lib", as well as changing source code.
I attached source code here, you may looks at it.
http://cfile208.uf.daum.net/attach/025A524151C3E65D1B5E63
in the zip file, sources in folder "gui" does creating GUI DLL.
sources in folder "main" actually loads DLL and try to call the function in DLL.
they compiles well, but it seems they do not work. it gets an error called "there should be only one application object" when I start main.exe
What is the problem?
Don't create QApplication object in your library. There must be only one QApplication object, and it's already created by the main app.
If you need to access QApplication object from your library, use qApp macro to obtain a pointer to the QApplication.
I want to create a gui, if it means implementing the code, where do I implement the code? And how to run the qtdesigener?
You can use Qt Designer, or Qt Creator which is a full developement environment (IDE) not just a GUI designer. Visit this site http://qt.nokia.com/products/developer-tools
Each window or widget in Qt generally is defined in 3 files:
some_name.ui - this file is generated by Qt Designer or Qt creator.
some_name.h - this is the C++ header file that contains Class declaration
some_name.cpp - this file contains C++ class implementation
some_name ofourse is the name of your widget/window.
When You add new windows/widgets to your Qt project you have to modify Your *.pro file which contains information on how to build your project.
The following tutorial shows a hello world in qt creator:
http://www.youtube.com/watch?v=QLT7oEt6gLE
I hope this is what you were looking for.