Dark mode in standalone Qt Designer on Windows? - qt

I'm developing one GUI app (among others) in Python with PySide2 and my main editor is VSCode and I'd like to keep it this way - I'm using the standalone Qt Designer for GUI layout calling it from VSCode when necessary.
I see that the full Qt Creator has a way to select couple of different dark modes in its IDE settings, however I see no such possibility in the Qt Designer launched as standalone application.
I develop on Windows 10 by the way and setting its dark mode doesn't change how Qt Designer looks, it keeps its Windows Vista look:).
Is there something that can be done, maybe a command line parameter?

Related

Design Mode requires a valid Qt kit, but installed and are able to run?

In Qt Creator it is possible to run the program clicking the green play button (using PySide6), but not edit the qml file in Design mode, where it gives the error "Line 0: The Design Mode requires a valid Qt kit" inside the design view. I created a project and selected Qt for Python (qml).
But I have installed several gb of the newest Qt version during installation? I have also selected the correct python env in the options.
When I create a non-qml project, but add a .qml file later a popup error says:
"The QML emulation layer (QML Puppet) cannot be built because the Qt version is too old or it cannot run natively on your computer. The fallback emulation layer, which does not support all features, will be used"
The Qt version is 6.2.2 and the OS is Windows 11. It is possible to use design mode in Qt Design Studio.
I meet the same problem and my environment is similar, choose Edit → Preferences and enter the Kits. Then select a Qt version and a kit you like (the type of qmake shall be the same, for instance, both of them is msvc), and remember to apply the changes.
After that, go back to the form editor and it works well. What confused me is that I must repeat the steps above each time I want to use Qt, the config seems to not be saved correctly. (The Qt version is 5.1.2 and the OS is Windows 11)
PS: After selecting the kit, you need to restart Qt.

In CLion, What is the difference between Qt Console and Qt Widgets Executable project templates

In CLion, What is the difference between Qt Console and Qt Widgets Executable project templates.
My intuition is that Qt Console is CLI and Widgets is GUI, but googling hasn't confirmed this. I'm hoping this QnA will help future googlers.
"Console" means text-based (which doesn't prevent it from opening windows or showing dialogs). On some platforms (e.g. Windows) this will force a "console" or terminal window to appear.
The "widgets" template is a pure GUI application (which doesn't stop it from manually opening a "console" or text-window on supported platforms).

Can't use the Design mode in Qt Quick projects

I have recently installed Qt Creator 5.12. I can use the edit mode to write codes and can the successfully build and run projects with MinGw compiler. However, I have problems with using the Design mode. The library of objects doesn't allow me to drag any of the the objects to my main window.
How can I overcome this issue?

Messed Up Layout in Deployed Qt Application on Windows 10

When I launch my deployed application from the .exe file the layout is messed up. When I launch the app from Qt Creator, the layout is fine.
Here are the details about how I deployed my app. I am using Qt 5.5 and MinGW 32 bit 4.9.2. I am running Windows 10.
First in Qt Creator I built for release.
Next, I opened the Qt 5.5 for Desktop (MinGW 4.9.2 32 bit) console.
I navigated to my project folder and ran
windeployqt.exe --release ./APPNAME.exe
It copied all the necessary .dll and created some folders as expected.
Now when I run the app, it seems to work just fine. But the layouts are all wrong. Again, when launching the app from Qt Creator it looks great! Proper spacing and sizing of my widgets. When I launch the .exe every thing is smooshed, the ratios of my sliders are all wrong, and some text is hidden because of crowding.
What could cause this bad layout? Am I missing some dependency somehow?
I figured out my own question. The issue was not my build or my layout but that many sizePolicy parameters don't seem to take effect when launching the app from QtCreator. Not 100% sure on the explanation but I think that when launching the .exe the OS is managing interpreting some of those size policy parameters and it does it differently (perhaps more strictly it appears) than QtCreator does. (To be clear I'm not talking about how the app looks in the Design tab. I'm actually talking about launching the app from within QtCreator)
So to fix the appearance of the app I have to play around with the size policies and parameters, build, and then launch the app from the executable.

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.

Resources