How to programmatically select QT QPA plugin - qt

I'm trying to make QT render to an image in a headless environment. I did it by passing a command line argument --platform offscreen. I prefer to do it programmatically but couldn't find any documentation. Does anyone know some way to do it?

Related

Is it possible to set icon for a custom file used by my app

I would like to create and app using Qt which will use custom files. The app will be available on Windows, OS X and Linux.
The idea is to have a custom icon for my file type (e.g. when you install Adobe's Master Collection, .as, .fla, .ps, etc. files have they own icons).
As far as I know Qt only helps you with app icon. I did not find any kind of support for this kind of problem.
This seems to be an OS problem. Do I need to create scripts to run on app install? (I will be using Bitrock's install builder to provide installers)
How can I achive this behaviour on all OSs?

How to pass arguments to Qt's DirectFB back-end?

When launching an embedded Qt application by specifying the directfb back-end, there is a way to pass arguments to it by using a specific syntax
./my-qt-app -qws -display directfb:960x720
This will change the resolution.
Let's say I'd like to remove the chrome from the application window. Since directfb has lots of options, how could I specify them via command-line? Should a look for the internal Qt implementation or use CLI arguments as specified by the DirectFB project?
UPDATE although there is a mechanism using colons to pass arguments to the
display back-end, in the directfb case it won't work for resolution changes.
Best way to pass multiple arguments is to use the standard directfbrc mechanism, usually located under /etc or the directory determined by ${DFB_CONFIG_DIR} environment variable.
Also noticed later that things like the application window chrome are set inside Qt itself, not DirectFB.
As #milton answered one place is /etc/directfbrc and the other way is for example:
./app --dfb:window-surface-policy=auto
you can pass help to get all the commands:
./app --dfb:help

Qt - Qml debugging is enabled. Only use this in a safe environment

I'm trying to run a very simple program that just closes the window when clicking the `exit button, but get the following output provided that the application window that contains the button does not show up:
Starting C:\Users\Ola\Desktop\signal_slot1-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2008__Qt_SDK__Debug\debug\signal_slot1.exe...
Qml debugging is enabled. Only use this in a safe environment!
What should I do in this case?
You have enabled QML debugging (actually it's on by default), this opens a port to the Javascript interpreter that is running the QML so you can get debug output from it. Obviously this creates a security hole, so it should be turned off when not being used in safe place (it's turned off automatically when you release compile). This warning is to remind you of that.
If you are not using QML, turn it off anyway. You can turn it off in the project's options page, where the build settings are (it's a check box in the qmake area).
Assuming you use Qt Creator:
If you select the Release-Build type the QML debugging will be disabled. To do this, select the build type on the bottom left corner above the "run" button and choose "release".
Manually, there is an option passed to qmake (either in the .pro file or via command line arguments) named
CONFIG+=qml_debug
which enables qml debugging.
If you omit that, it should be disabled.
You can change it to release mode if you want to and that would solve the problem
but I recommend you to change between MSVC and MinGW and check which one is going to work.
Project->Build and Run-> and choose what you need.

is it possible to make Qtcreator target as directfb instead of X11

my target to display output is directfb window. i need to develop an qt application. i found developing application in qtcreator is much easier but problem is output will be seen on X11 window. can any one tell me is there way to get it executed on directfb window. i have no search results for this in google. plz help me
i am using xubuntu
thanks
regards
rashmi
In Creator, you should be able to change your build target to a specific version of Qt. First, see if the simulator target for recent Creator versions will cover you. If not, you'll need to download and compile the Qt embedded version you want to target. Then, add that version as one of the Qt Versions and change your build settings to use that version of Qt.
go to tools->options->qt4
add qt version you have installed in my case qt-4.7 i.e,
qt4 version= qt-4.7.0
path to qmake is /path to qt directory/bin/qmake
then rebuild.
you are done with changes you wanted.

how to change the look and feel for Qt form?

i need to change my form look and feel and i dont know :
what i need to download and install ?
is there any ready to use look and feel installed into qt library ?
i am using windows and qt 4.4.3
Take a look at Widget Styles and Stylesheets (both linked to Qt 4.4 since that's your version).
Edit: In other words, you don't need to install anything else. Styles are built into Qt.
Look-and-feel is pretty vague -- you can change the GUI application style by adding the -style STYLENAME command line argument when you run the program. You can change to the application to run under motif, windows, platinum, or any other custom styles that you might have compiled (such as plastique).
Here is more information about it in the Qt Docs: http://doc.trolltech.com/4.6/qapplication.html#QApplication

Resources