Test WinXP look on other platforms? - qt

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.

Related

can my Qt Application get Mac look on windows

As Qt application will be in native look and feel.
I want to get mac look and feel for my Qt application. Is it possible to do so?
It is possible to change look and feel of Qt application by using styles:
QApplication::setStyle("macintosh");
List of available styles is given by:
QStringList list = QStyleFactory::keys();
But for example on Windows Mac style is typically unavailable. I tested on Windows machine with Qt 5.4 - only Windows (Windows, WindowsXP and WindowsVista) and Fusion styles are available - you can switch between them.
Of course, Windows style is default for Windows. It is advised to set style before constructing QApplication.

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.

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).

Is there a way to run Qt Creator from command line supplying a .pro file to open (or how do we deal with multiple Qt installations)?

I have multiple installations of Qt4 on my Windows XP SP2 machine and have installed Qt Creator 2.1 today. However, running the project (.pro) files spawns the oldest version of Qt Designer installed (the one installed in 2009 together with the rest of the framework).
Since
I would not like to remove any previous installations of Qt
and for some obscure reason even if I explicitly ask Windows Explorer to always use the version I need it does not
I would like to give up a bit and just sript the needed behaviour in a .bat file like:
e:\path\to\qtcreator.exe %1
This opens Qt Creator, but something seems to prevent it from treating the .pro file properly (in short, the project does not "open" as it should).
Qt documents have a page on the matter at Qt Creator: Using Command Line Options, but it seems to ignore the topic in question.
Since Qt (being as excellent framework as it is) is also known to have its quirks (like that of qmake), I wonder, may be there is an undocumented way to solve my problem?
(Another way to fix the thing would of course be to make the correct version of Qt Designer run, but frankly I'd prefer the "hard-wired" solution since the mechanisms provided by Qt itself are still a bit unreliable.)
The libraries and tools used for a particular project (and a configuration in it) is set in the Projects panel in Qt Creator:
http://doc.qt.io/qtcreator/creator-build-settings.html
Selecting the Qt version to use with a project should force it to run the Designer that's part of the version. If it doesn't, then you should report it as a bug.

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