how to change the look and feel for Qt form? - qt

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

Related

add module in qt(QML module) [duplicate]

So when I create a new Qt project inside Qt Creator I'm only asked for some simple details like location of the project, build targets, the main window class name (along with header, source and form file) and at the enda choice to add it to version control.
After I create the project I'm only given the qt core and gui modules. My question is how do I add other modules (such as network or opengl). I've looked and looked, yet I cannot find anything on how to add other Qt modules easily. I know I can edit the .pro file, but unfortunately I don't know all the modules in Qt, nevermind the name I'm supposed to put there. Adding external libraries is easy, but how come there's no (obvious) option to add Qt libraries?
Help would be much appreciated ^_^ Thanks!
Oh yeah... I'm running Arch Linux if that's any help.
Edit your .pro file. It should has one line like this:
QT += core gui
Append the desired modules in this line. To get the module's names, just remove the "Qt" part in this list. (e.g. QtSql turns "sql")
I can't find that either.
It seems that in older versions of the "New project" wizard you used to be able to specify which modules you wanted to use, but even then you were not able to alter your choice later. And this seems gone now, so your only choice is to manually edit the .pro file.
As others have pointed out, you simply #include the module you want in the source and add the name of the module in the .pro file to the QT variable.
However the actual documentation you need which no one else has mentioned is the qmake Project Files page. qmake is very powerful and it's well worth getting familiar with how it works and I think that's why they don't provide a complete GUI for it, as it can handle some very complex scenarios.
You have to read the documentation to add the modules.
Frankly speaking, I never really felt like that there needs to be a GUI for that.

How to prevent Qt Designer from loading incompatible plugins?

Qt Designer and Qt Creator when trying to edit ui files have started to crash recently. I've found it's because of KDE widget plugins that are built for a previous version. However, I can't find a way to disable them. Is there a way to do this?
For Qt Designer, there is a config option that allows you to disable specific plugins. Exactly how you do this may differ for each platform, but on my Arch Linux system I have the following config files:
Qt5: $HOME/.config/QtProject/Designer.conf
Qt4: $HOME/.config/Trolltech/Designer.conf
And in the Qt5 file, I have disabled all the KDE plugins by adding a section like this:
[PluginManager]
DisabledPlugins=/usr/lib/qt/plugins/designer/kdewebkit5widgets.so, /usr/lib/qt/plugins/designer/kf5deprecatedwidgets.so, /usr/lib/qt/plugins/designer/kf5widgets.so
So it's just a matter of adding the full path of any plugin you want to disable to a comma-separated list.
I don't use Qt Creator, but if the above doesn't work, I understand it may also be possible to disable plugins via Help -> About Plugins.

How can I compile Qt app in Linux using Windows style?

I'm developing a Qt Widgets application and due to compile performance issues, I started developing it in Linux Ubuntu instead of Windows. The problems is that, when compiled and run, the app appears with traditional Ubuntu style instead of Windows (7) style. Since the app is only for Windows, I'ld like to know how can I compile it inside Linux Ubuntu but making it appear with Windows style.
I tried using QApplication::setStyle(QStyleFactory::create("QWindowsStyle")); in main.cpp, without success. I guess the QtAssistant docs just aren't clear enough on how can I do this change. Any help will be appreciated.
Could you by any chance be using a Qt package that is compiled without the style? Can you try running QStyleFactory::keys() to verify that the style exists?
It can't be done, since the style's elements are rendered by Windows (or OS X), not by Qt. Qt's style implementation asks the OS libraries to provide bitmaps of those elements. If you wanted to, you could modify the style to use a disk cache for static items. You could then use the style on all platforms. The problem is that these OS-provided bitmaps are a part of the OS and thus non-redistributable.
The only plastform-specific style that at least used to be available everywhere was the old Windows 95 style, in times of Qt 3. I'm not sure what its current status is.
First check out put of QStyleFactory::keys()
then set the look by calling
qApp->setStyle("Windows");
This command will give you windows 98 look. If you want windows vista look you should configure qt sources with -style-windowsvista and rebuild all sources.
UPDATE
according to http://doc.qt.io/qt-5/qstylefactory.html#details qt style is not platform independent. So IT IS IMPOSSIBLE to have that native look in not windows platform. It's worth mentioning that in windows also Windows SDK itself is required in order to build sources of Qt otherwise your application will look like windows 98 in windows 7.

Test WinXP look on other platforms?

Is there a way to test the look of my UI on Windows or other platforms from my Linux machine? I'd like to have some idea of how it will look without having to rebuilding the project on a windows machine.
At the command line for your program you can specify the style:
http://qt-project.org/doc/qt-5.0/qtwidgets/qapplication.html#QApplication
-style= style, sets the application GUI style. Possible values depend on your system configuration. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the -style command line option. You can also set the style for all Qt applications by setting the QT_STYLE_OVERRIDE environment variable.
In some older documentation it mentions:
Possible values are motif, windows, and platinum.
I just tried this on Windows 8 with Qt 4.8.4, and I got no change adding in "style=platinum" or any of the others, and apparently the build of Qt that I got did not come with the additional style plugins. So, build Qt with the additional styles, and then you can preview the look for other OS's.
Hope that helps.

what does native="true" stand for in a Qt designer form

I am doing a diff between 2 project versions and noticed that some of the ui files have extra attributes in the xml that I have not put there myself:
where would native="true" come from? what would make it get added to the ui?
Qt GUIs can be displayed in many themes. native="true" forces the application to use the operating system's theme (on Linux, some QT apps look terrible because they don't look like the rest of the native apps).

Resources