Do all Qt applications require KDE to be installed? Is it enough if the Qt runtime is installed along with GNOME? Can I make a Qt application look exactly like a GTK application under GNOME? Could anyone please point me to some article detailing the relationship between Qt, GTK, KDE, GNOME, X?
-
On linux, is the following correct? - Application uses Qt to draw it's UI. Qt draws to X and X draws to the hardware? Is it possible to simply start X server and run a Qt application without GNOME or KDE being loaded? If so,how? How do Window Managers come into the picture? – BlueSilver Mar 17 '10 at 08:43
-
Does Qt draw directly onto X or does it do it through a window manager? Does Qt use a Window Manager to draw windows, or do window mangers use Qt to render windows? – BlueSilver Mar 18 '10 at 04:57
5 Answers
When running under X, Qt apps and the Window Manager are both X Clients. They both communicate with a XServer to draw, receive input, or manipulate windows. The XServer knows about the hardware and handles drawing to a specific monitor, receiving mouse input etc.
It is possible to run a Qt application without a desktop environment, and even without a window manager (although you won't be able to move/resize the program). Window managers etc are just normal X programs that are running that provide their own functionality but only indirectly interact with each other. They don't depend on another specific program running.
The state of windows (position, ordering, contents) are managed by the X Server, and can be queried and changed by a program such as the window manager.
The window manager handles the sizing, positioning and decoration of windows. It receives events when a window is created/changed so it can do so. It draws the frame around the outside of a window, and handles clicks on close, maximize, drags of the window etc.
The Qt application draws inside the main window and handles mouse clicks and keypresses inside the window.
Qt can communicate with the window manager by sending XEvents from the window (resize/move), or setting WM Hints (dialog, important, not resizable). These go through the XServer and won't have any effect if no program is listening for them.

- 18,439
- 2
- 38
- 52
-
thanks for the info. I'd like to know this stuff in greater detail. Could you provide me with links to any resources on the net? – BlueSilver Mar 22 '10 at 09:15
-
@fgb Thanks for this awesome answer. If Qt is handling mouse clicks and keypresses does this mean the "X Server" does not know what happens on the Qt window. – Talespin_Kit Dec 17 '18 at 10:46
I run Qt applications regularly on my Mac, and occasionally on Windows, and I'm entirely certain that neither the Macs nor the Windows PCs have KDE installed (nor Gnome for that matter). So, to your first question, the answer is "definitely no":-).

- 854,459
- 170
- 1,222
- 1,395
Qt is just a UI Library, just so happens that KDE is written in/using Qt.
You can write an app using Qt and run it with gnome being installed as long as you have the Qt library installed.
Yes you can make Qt applications look like gnome applications as long as it is using the theme the system is using. (not sure how just know it in general) I use several Qt UI based apps written in python under ubuntu with gnome and they use the theme just fine.

- 3,560
- 6
- 30
- 42
-
2Nitpicking... It is Qt ("cute"), not QT (QuickTime™). "written in Qt" doesn't sound right since Qt is not a programming language. Things are written in C, C++, English, French... KDE *uses* or *links to* Qt. – Juliano Mar 17 '10 at 17:51
-
Well, vice versa. Historically KDE (and now) was built on Trolltech Qt C++ framework. Qt C++ is now cross-platform and that makes KDE adventures to many platforms more smoothly. So shortly: KDE depends on Qt :)

- 17,944
- 33
- 103
- 135
When you develop a Qt application one of the choices you have is to include KDE widgets or libraries in the application. If you do this then you would require some KDE packages (on Linux) or libraries to be installed on your target machine as well as the Qt ones. I'm not sure what the availability of these is on Windows or Mac, although there is some sort of attempt to port KDE to Windows, ongoing.

- 1,081
- 2
- 8
- 17