如何GTK和Qt的Linux相比集成到他们的Windows和OS X如何集成? [英] How do GTK and Qt integrate with Linux in comparison to how they integrate with Windows and OS X?

查看:381
本文介绍了如何GTK和Qt的Linux相比集成到他们的Windows和OS X如何集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的理解,Qt和GTK在Windows和OS X侧只是包装了本地GUI库,像OS X它将绕可可,和周围的Win32窗口。不过,我的问题是,他们如何使用Linux集成?做桌面环境开发人员必须实现对Qt的两种或GTK或它是如何工作的专业图书馆?我环顾四周,但我真的不能找到答案。

From my understanding, Qt and GTK on the Windows and OS X side are just wrappers around the native GUI libraries, like for OS X it wraps around Cocoa, and for Windows around Win32. However, my question is, how do they integrate with Linux? Do the Desktop Environment developers have to implement special libraries for either Qt or GTK or how does it work? I have looked around but I can't really find the answer.

推荐答案

在Linux操作系统(台式机和笔记本电脑)一般显示在图形屏幕(至少是在2015年开始的情况下)的的 X11服务器。您的GUI应用程序与该服务器的直通插座上的 Unix套接字 /tmp/.X11-unix/X0 。在X11服务器一般的Xorg

On Linux (desktops and laptops) the graphical screen is generally displayed (at least that was the case in beginning of 2015) by the X11 server. Your GUI app is communicating with that server thru sockets, often locally on a Unix socket like /tmp/.X11-unix/X0. The X11 server is generally Xorg.

有关(汽车,汽车和医疗器械行业GPS)如Android手机的一些嵌入式设备或某些小工具是不同的(的 DirectFB的帧缓冲设备的首位,而其使用桌面上的X11服务器,...)

For some embedded devices like Android mobile phones or some gadgets (GPS in cars, automotive or medical device industry) it is different (DirectFB, framebuffer devices -which is used by the X11 server on your desktop, ...)

一些分布切换到韦兰(或者到的米尔)。因为我不知道这些了,我无法解释的血淋淋的细节。 AFAIU,还有一些涉及服务器(其中,像Xorg的,它唯一的用户级软件组件交谈,​​你的显卡)和一些协议和主要工具包一样的Qt和放大器; GTK都已经适应他们(因此,如果您code Qt的或GTK,你不关心这些细节,但你应该升级工具包)。

Some distributions are switching to Wayland (or perhaps to Mir). Since I don't know these much, I cannot explain the gory details. AFAIU, there is still some server involved (which, like Xorg, it the only user-land software component talking to your graphics card) and some protocol, and major toolkits like Qt & GTK are been adapted to them (so if you code for Qt or for GTK, you don't care about those details, but you should upgrade your toolkit).

图形工具包(QT,GTK)与X11服务器将向您介绍一些具体的协议上,例如交互(或韦兰一个) X Window系统的协议了解X11。由于历史原因,这些协议是相当复杂的,和实际需要遵循一些约定喜欢的 EWMH

The graphical toolkits (Qt, Gtk) are interacting with the X11 server (or the Wayland one) thru some specific protocol(s), e.g. X Window System protocols for X11. For historical reasons, these protocols are quite complex, and practically require to follow some conventions like EWMH.

又见这个答案以一个相关的问题。我解释一下那里X11是不是今天使用,因为它是在previous世纪;特别的服务器端绘制X11 的能力(例如Xlib中的 XDrawLine 或的 XDrawText )今天很少使用,因为该工具包绘制像素图的图像客户端和<一个HREF =htt​​ps://tronche.com/gui/x/xlib/graphics/images.html相对=nofollow> 发送到服务器。

See also this answer to a related question. I explain there that X11 is not used today as it was in the previous century; in particular the server-side drawing abilities of X11 (e.g. Xlib's XDrawLine or XDrawText) are rarely used today, because the toolkit is drawing a pixmap image client side and sending it to the server.

注意,你可能会考虑给没有GUI界面,而是一个的Web界面,你应用程序(例如,使用库如 libonion ,的 WT ,....);那么你的应用程序成了一个专门的Web服务器,用户会去他的直通浏览器(在他的台式机/笔记本/平板电脑/手机),以与应用互动。

Notice that you might consider giving not a GUI interface, but a Web interface, to your application (e.g. using libraries like libonion, Wt, ....); then your application becomes a specialized Web server, and the user would go thru his browser (in his desktop/laptop/tablet/phone) to interact with your app.

实事求是地讲,是如此复杂,你真的应该使用一些工具包,为他们用户界面( 的Qt 如果编码C ++)。从头开始编码(甚至高于的Xlib 或的为X11 XCB )将需要多年的工作。

Practically speaking, user interfaces are so complex that you really should use some toolkit for them (Qt if coding in C++). Coding from scratch (even above Xlib or XCB for X11) would requires years of work.

有几种其他部件工具箱上述X11,例如 FOX工具包,的 FLTK (但他们大多比的Qt或GTK少得多的功能)。

There exist several other widget toolkits above X11, e.g. FOX toolkit, FLTK (but most of them have much less features than Qt or GTK).

这篇关于如何GTK和Qt的Linux相比集成到他们的Windows和OS X如何集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆