I need to play sounds under Qt with control of volume and panning. QSound doesn't do it, phonon may be too much for only this so I thought I'd try the native api.
eeermm, in Mac I have no idea, is there some simple interface to invoke on c++? (I've seen all this NSSound stuff but I am not familar with Objective C and I am not sure if it's possible to mix code (under QtCreator)) my idea would be to a module with simple native api calls to system features not found on Qt.
Thanks!
Qt AudioEngine in Qt5 will do this.
If you're using Qt4, making a single 'Objective-C++' file (extension .mm) which can be called from Qt, but makes NSFoo calls, is easy and works well. The header file should be plain C++, and everything will work together.
Related
The Android application I am about to work on has the UI in Java and the non-UI functionality in C++ that would be accessed via JNI. The C++ code uses some non-UI Qt classes. I am thinking I will spawn a thread in JNI_OnLoadthat essentially will instantiate and run QCoreApplication. Any subsequent JNI call will simply post an event to this thread. Is this possible? Regards.
What you want to do is definitely possible but a bit more difficult than it seems initially.
If you build your app end to end in Qt there's a lot of functionality you get for free from their framework that allows it to run on Android and a lot of that functionality/plumbing is wrapped up in their UI. So if you're not using their UI there's extra work that you need to do.
On Android their UI framework basically creates a native Activity and then uses that activity as a wrapper for the app. If you look at the low-level source for their UI thats what's happening on Android and it's what allows the Qt app to access local resources, the network, OS facilities, etc.
Without the Activity wrapper, your app will only be able to do simple, in-memory operations that require no OS, file system, or network access and also won't be able to make use of other Qt libraries(eg Qt5Sql, Qt5Core, etc).
Here's what we had to do to make this work in our java app:
Create a proxy wrapper Activity for Qt to use that shares the base
context of your app.
Create a QtActivityDelegate.
Set the proxy activity and delegate using the native Qt android
libraries. eg QtNavite.setActivity.
Instantiate and set a DexClassLoader using the same native Qt android libraries.
Load any Qt libraries using System.loadLibrary(..). Please note that the libraries need to be present on the file system already. This part was a big pain for us.
For your Qt Code, make sure you have proper wrappers written so that they can be used via jni. We ended up using swig to auto-generate java wrappers for our code.
You can find out more about swig here: http://swig.org/
After all that you should be able to use your Qt class/library from within a native Android app.
Painful but definitely possible!
I was wondering if there might be something similar to loadUiType for the resource file.
Of course one can use pyrcc5 example.qrc -o example_rc.py but than I have to do this step every time something is changed.
Using:
from PyQt5.uic import loadUiType
Ui_MainWindow, QMainwindo = loadUiType('~/example.ui')
renders the usage of the pyuic5-step unnecessary, which eases the application building process a bit.
How would one do that with the resource file?
cheers,
Christian
At one time, both pyuic and pyrcc were pure commandline tools written in C++. But the pyuic tool was ported to python for PyQt4 (I think as a student project by Thorsten Marek), and now has a separate uic module of it's own.
I don't think anyone has ever suggested porting pyrcc to python. A brief skim of the code (it's quite short), suggests this might be feasible, but it probably wouldn't be straightforward.
As stated in the comments, there is a QResource class that allows resources to be registered at runtime. But it still requires pre-compilation using the external rcc tool. Since PyQt generally follows the Qt APIs quite closely, this probably explains why it also doesn't have a way to directly compile and load resources at runtime.
I just started looking into TideSdk and noticed that when I "compile" (or package) a project (in Win-7), I get all of these dependecies which is actually the un-compiled source code for the app.
Is there any way to:
Have Tide SDK package a file to one executable
Not have the source code visible in any way, shape, or form in the final executable?
If none of those are possible, is there an alternative that can to these things?
We are working on a solution. There are a few possibilities. The only thing that is possible currently is to obfuscate your code using google closure library through a tidebuilder option.
I found this on google when trying to do something similar. It is annoying but seems to work.
http://coffeecone.com/post/36127491095/howto-single-exe-for-tidesdk
I use the application virtualization app Cameyo for this purpose. http://www.cameyo.com/
please bear in mind I am not a GUI programmer.
As the title says but to give a little more details:
I have a very large C++ application which I would like to upgrade the GUI for. There is an SDK that we can attach a new GUI onto and I would like to make it look as modern and fancy as possible, I have been advised to use HTML5 for this.
We build and link the project using in house bat files which I have hooked into MSDEV to save me going back to the console every time I want to build the project. I also use MSDEV to attach to the programs when they are running to debug.
Can I also do this in QT?
(I cannot download it and try as I need to have a business case for downloading new software and investigation is a hard one to get approved).
If I did this in QT, could I then use Webkit to create a HTML 5 front end or is there more work required?
What Does Qt Look Like
http://www.youtube.com/watch?v=bVQ0S-b5lDs
The demo program that comes with the Qt SDK shows off quite a bit of what you can do with the GUI programming. You can build almost anything you can imagine!
It looks native to the operating system it is running on, Windows 7, Mac OSX, Ubuntu, etc.
I believe most of the Linux KDE GUI is now done through Qt.
Running Console Applications
If you need to run things from the console, you can manage that in C++ pretty easily.
system("run_this.bat");
In Qt, if you don't need to see the console window, you can run most things as a QProcess.
There are ways to hook the stderr and see what is going on as well.
HTML 5
Something written in HTML 5 shows up in a browser, and there are a number of slick graphics and effects that can be used with it, but using the QtWebKit, will only ensure that the webpage you are rendering looks the same on every computer you run it on. Most modern browsers are becoming HTML 5 compliant, so relying on the HTML 5 out of Qt shouldn't be necessary.
W3Schools gives a pretty good introduction into what HTML 5 adds to websites:
http://www.w3schools.com/html/html5_intro.asp
Using HTML 5 or C++
Writing a web application that uses HTML 5 versus writing a Desktop application that uses a native GUI are two very different things.
Running files on a local machine is pretty sandboxed when going through a browser with HTML 5. If you are okay with running something remotely on your own server, then it shouldn't be too bad.
I need to trigger a phone call from a Qt application. I looked to previous post without find a complete answer.
I need to make it with qt 4.6.3. I'm quite new to symbian development, I'm using the last nokiaSDK.
It MUST work ONLY on n97 and E71.
Can Anybody provide a solution?
May be a solution exec an extenal process using QProcess?
It seems like currently none of Qt APIs (including QtMobility) allows to do it. However, you can use native Symbian C++ API - CTelephony class. There are some examples showing how to make a phone call using this class. The obvious disadvantage is that it won't work on any other platform than Symbian.
You may be interested in this example: http://library.forum.nokia.com/topic/Qt_for_Symbian_Developers_Library/GUID-B4DA6005-3037-4FF8-82D5-BA748532E648.html#GUID-B4DA6005-3037-4FF8-82D5-BA748532E648. It shows how to mix Symbian C++ code with Qt code, and it also uses CTelephony, so you just need to change method call from GetPhoneId() to DialNewCall(). Don't forget to add appropriate library (etel3rdparty.lib) in your .pro file.