How does stylesheets work in Qt? - windows

It is just curiosity. In Windows, for instance, how Qt interprets the stylesheets? this seems to be trivial, but, how does Qt tells the operating system to change the appearance of the widgets? Which library of methods of the Windows API uses? Does WPF uses the same Windows API libraries?
Cheers,

Qt custom draws all widgets. Qt may, under the hood, call into to OS provided API's for rendering each widget but a QButton is not an HWND using the BUTTON window class on windows. Qt does seem to use the OS for rendering text on the widgets but only the glyphs, not the complex rendering available in QLabel for example.

Related

Using winapi and opengl functions(c++) in Qt application (wndproc)

guys! We have working Project win32 with winapi functions which draws cube. We create a WNDCLASS and opengl context there for drawing. Can we use same functions like WinMain and WinProc in Qt for windows message processing?
We tried to do it, using hwnd of the window, without creating WNDCLASS. But after that we have just window without drawing area and rendering.
We should use winapi functions for next unloading theese functions in dll and use them in python and delphi.
Here is cpp-file
http://rgho.st/7KwpPfxZG
QT is a cross platform framework and takes care of hiding away things like WinMain and WindowProcs and instead provides a platform neutral abstraction.
Fortunately OpenGL is directly supported by QT - and they even have a page showing how to integrate OpenGL with QT here:
QT GUI OpenGL Window

Simple GUI library for basic GLUT CAD application?

I want to create a very simple CAD application written with GLUT library. I just need this to create simple dice editor application for computer graphics class, so an easy-to-use GUI library that supported GLUT is what I basically need for this project. I stumble upon GLUI, but it doesn't have widgets such as color chooser or file loader dialog. Is there a suitable GUI library for GLUT that I can use?
There are gui libraries like Qt or FLKT, but they have their own main loop.
on windows you should call directly the native files dialogs GetOpenFileName() and GetSaveFileName(). If you want a cross platform solution and to exactly answer the question, yes there is "a suitable GUI library for GLUT that (you) can use": look for tiny file dialogs on sourceforge it even has a color chooser and has no main loop.
You want a simple GUI library yet you want it to have advanced features.
Open File Dialog
Depending on what OS you want it to be running on you can pop up the OS specific file opening dialog. It does not have to be shown inside of the application window. Instead let it pop a new window with the OS file open dialog.
Color Chooser
Implementation of a simple Color Picker widget is not that hard really. Three sliders for RGB and a box to show the color chosen.
You can also use the OS (Windows) specific color picker. And skip the implementation inside you app altogether.

Qt keyboard events with DirectX fullscreen

I need to display a full screen DirectX window from a Qt app.
Although directX isn't supported directly anymore by Qt this should be easy enough - just override QWidget, provide your own paintEvent() and set a WA_PaintOnScreen attribute.
But when the app is full screen DirectX is grabbing all the mouse and keyboard inputs - so the only way out of the app is ctrl-alt-del.
ps. Even if I wrote DirectX keyboard handlers I would still have to find a way of creating the correct Qkeypress event to pass to Qt.
Has anyone done this? Or is there a simple way to tell DirectX not to grab the keyboard?
To my knowledge Direct3D does not get the keyboard. Your problem more likely arises from the fact that Direct3D in full-screen is quite a different beast. Things like GDI (which Qt may well use to do rendering) do not work by default, the run-time hooks lots of bits of information. That info then, presumably, never manages to get to Qt. The options you have are to re-implement Qt to render using Direct3D (Lighthouse project?) or to use a pseudo full screen. This is usually done by creating a window that has a client area the same size as the screen and then positioning it correctly.
The latter would probably be the simplest solution ...
There was an attempt to get a D3DWidget kind of thing in Qt 4.3-4.5 or something like that, but it never was stabilized or approved and later even removed.
Perhaps indeed lighthouse is an option (with a medium sized amount of work, basically links OS/DX stuff to Qt stuff) or you can take a look at the old direct3D code in older Qt branches. I never used it, and it probably isn't intended to use with recent versions of Qt, but it's better than nothing.

OS X transparent panels in Qt?

Is there a way to create a transparent panel as described by the Apple Human Interface Guidelines in Qt 4.6 (built for OS X 10.6/Cocoa)?
If not, are there any alternatives similar in look and function?
I understand that Qt is a cross platform toolkit, but I want my application to feel as "native" as possible.
I haven't tried on Mac, but this should be possible. Here's what the QWidget docs say:
Creating Translucent Windows
Since Qt 4.5, it has been possible to create windows with translucent regions on window systems that support compositing.
To enable this feature in a top-level widget, set its Qt::WA_TranslucentBackground attribute with setAttribute() and ensure that its background is painted with non-opaque colors in the regions you want to be partially transparent.
Platform notes:
X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.
Windows: The widget needs to have the Qt::FramelessWindowHint window flag set for the translucency to work.
I imagine your panel is a top-level widget, so make sure to set Qt::WA_TranslucentBackground as directed in the above.

GUI framework for automatic resizing

I want to build a desktop app where the size of both the window and the content is resized automaticly according to the resolution of the monitor. I know it can be done easily with the docking features of .NET Forms, but my customer insists on going with Linux so I can't use it.
I tried Flex & Air, but the content is not resized automaticaly when I put the app in fullscreen or in another resolution (the app goes full screen but I still have tiny buttons). Now, I am looking at Qt and Gtk...
Is there a GUI framework that can do that? I don't care about the programming language.
Also, since the app will go in a bar it would be nice to be able to customize easily the skin. (like in Flex, WPF, etc.)
Regards,
Pascal
An excellent place to start is understanding how the Screen class works: MSDN Even though that is .Net, it will give you an idea of how the screen size, dpi, etc. can be obtained. In addition that information should translate to the Mono platform. Since your client is insisting on Linux, you should look at MonoDevelop and then possibly the GTK# framework. My understanding is that GTK# is not a very friendly (that is pretty) development system (yet).
See:
MonoDevelop
GTK#

Resources