简体   繁体   English

什么跨平台GUI库对每个平台都有最本土的感觉?

[英]What cross platform GUI library has the most native feel for each platform?

I've noticed that GTK has a uniform feel across all platforms, which is great for Linux lovers, but not so great for people who prefer their native GUI feel. 我注意到GTK在所有平台上都有统一的感觉,这对于Linux爱好者来说非常棒,但对于喜欢原生GUI感觉的人来说并不是那么好。

I haven't used Qt properly yet, which is why I'm unable to say that this is the best choice to provide the most native feel for each platform - so could someone please confirm whether Qt is what I'm after? 我还没有正确使用Qt,这就是为什么我不能说这是为每个平台提供最原生的感觉的最佳选择 - 所以有人可以确认Qt是否是我追求的?

I think Qt is a great choice to have a native look. 我认为Qt是一个很好的选择,有一个本地的外观。

On Windows XP, widgets will be rendered with the Luna style (Windows XP default style). 在Windows XP上,窗口小部件将以Luna样式呈现(Windows XP默认样式)。 On Vista/7, they will be rendered with the Aero theme. 在Vista / 7上,它们将使用Aero主题进行渲染。 On MacOS, they will be rendered with the Aqua theme. 在MacOS上,它们将以Aqua主题呈现。

On Linux, it's different. 在Linux上,它是不同的。 Qt will use his own theme (Plastique style) or use your KDE theme (Oxygen theme for example). Qt将使用他自己的主题(Plastique风格)或使用您的KDE主题(例如Oxygen主题)。 If you prefer GNOME or XFCE (GTK), Qt can also use your GTK theme. 如果您更喜欢GNOME或XFCE(GTK),Qt也可以使用您的GTK主题。

替代文字

A Qt application can be perfectly integrated in Windows XP/Vista/7, MacOS, KDE, GNOME and XFCE desktops. Qt应用程序可以完美地集成到Windows XP / Vista / 7,MacOS,KDE,GNOME和XFCE桌面中。

Wxwidgets uses the underlying platform to draw widgets (GTK under Linux, MFC under Windows...), so not only it looks native, but it is! Wxwidgets使用底层平台绘制小部件(Linux下的GTK,Windows下的MFC ......),所以它不仅看起来是原生的,而且它是!

Edit - For Mac, wxWidgets uses Carbon, and is currently transitioning to Cocoa for 3.0. 编辑 - 对于Mac,wxWidgets使用Carbon,目前正在转换到Cocoa for 3.0。

Edit2 - I did not use QT myself, but people around me that used it liked it a lot. Edit2 - 我自己并没有使用QT,但我周围的人使用它很喜欢它。 On the QT application that I've used under Windows, I have felt less native, with somewhat poorer integration with the desktop, but it could just be a reflexion of these particular developers skills. 在我在Windows下使用的QT应用程序中,我感觉不那么原生,与桌面的集成稍差,但它可能只是对这些特定开发人员技能的反思。

Although wxWidgets has its quirks (somewhat poor integration on the STL, MFC-like events, sometimes hard to grasp box options, limited wxGrid...), they are being worked on, and the system is getting better and better (the new wxAUI docking widgets are awesome). 虽然wxWidgets有它的怪癖(在STL上有点差的集成,类似MFC的事件,有时很难掌握盒子选项,有限的wxGrid ......),但它们正在被开发,系统越来越好(新的wxAUI)对接小部件很棒)。

Finally, wxWidgets has been remarquably good at staying off my way when I did not need it, allowing me to use it precisely for what I wanted and nothing more. 最后,wxWidgets在我不需要的时候已经非常好地避开了我的方式,允许我精确地使用它来满足我想要的东西,仅此而已。 I was for example able to plug extremely easily my own socket code into the event system. 例如,我能够非常轻松地将自己的套接字代码插入到事件系统中。

My feeling is that wxWidgets and QT are pretty much comparable, and going to one or the other will be mainly about personnal fit. 我的感觉是wxWidgets和QT几乎相当,而且其中一个或另一个主要是关于个人适合。

Out of Qt and WxWindows from a clean slate I'd go for WxWindows - simply because it uses the native controls which gives you better support on future platforms. Qt和WxWindows来自一个干净的平板,我会选择WxWindows - 只是因为它使用本机控件,可以在未来的平台上提供更好的支持。

I arrived at this decision by the following unscientific process: 我通过以下不科学的过程得出了这个决定:

  • Reviewed the list of published applications and selected those that most looked like something native 查看已发布应用程序的列表,并选择那些看起来像本机的应用程序
  • VLC Media player vs. FileZilla - sometimes to me VLC feels quirky whereas I hadn't even realised that FileZilla was written in WxWindows. VLC媒体播放器与FileZilla - 有时对我来说VLC感觉很古怪,而我甚至没有意识到FileZilla是用WxWindows编写的。
  • 5 out of the alleged top 32 applications use WxWindows. 据称前32个应用程序中有5 使用WxWindows。

For me, the above is easily enough to go with WxWindows as a first choice and see where I end up after a while. 对我来说,上面很容易与WxWindows作为首选,看看我在一段时间后最终会在哪里结束。

Worth mentioning that I've been doing a lot of XAML and so I'd definitely be looking into using XUL instead; 值得一提的是,我一直在做很多XAML,所以我肯定会考虑使用XUL; as it is much nicer to get the layout out of the code. 因为从代码中获取布局要好得多。

As a footnote years ago I developed an application using the thankfully long-dead and dreadful ZincApplicationFramework - which layers it's own controls ontop much like Qt. 作为一个脚注多年前我开发了一个应用程序使用谢天谢地的长期死亡和可怕的ZincApplicationFramework - 它将自己的控件分层,就像Qt一样。 It was dreadful and I spent ages messing about with the internals to get it to work right under Windows. 这是可怕的,我花了很多时间搞乱内部,让它在Windows下工作。 This makes me prejudiced, or a least skeptical, of anything taking the same approach, because shortly after this project finished I used Allegris C++/Views to create another application, and this was much better because it was a very thin layer above the native controls - which meant that it was easy to do things and a lot more efficient. 这使得我对采用相同方法的任何事情产生偏见或者至少持怀疑态度,因为在这个项目完成后不久我使用Allegris C ++ / Views来创建另一个应用程序,这更好,因为它是一个非常薄的层,高于本机控件 - 这意味着它很容易做事而且效率更高。

So I may have a preference towards thin layers and native controls.... 所以我可能偏爱薄层和原生控件....

Yes, I believe it is. 是的,我相信它是。 Qt tries had to follow the native look&feel. Qt尝试必须遵循原生的外观和感觉。 Not only how the widgets look, but also things like button order, etc. Of course building an application that really follows all native UI conventions is going to be hard (the Mac UI design is very different from Windows, for example), but Qt will help you a lot with it. 不仅是小部件的外观,还有按钮顺序等等。当然,构建一个真正遵循所有原生UI惯例的应用程序将很难(例如,Mac UI设计与Windows非常不同),但是Qt会帮助你很多。

I have zero experience with Qt, but SWT has native look-and-feel for the major platforms by virtue of the fact it ships native libraries to do the job. 我对Qt没有任何经验,但SWT凭借本地图书馆完成这项工作的事实,为主要平台提供了原生的外观。 We've used it to make Eclipse plug-ins for our various projects. 我们用它来为我们的各种项目制作Eclipse插件。

WxWidgets and Qt both look right on OS X, but don't work right unless you do a bit of extra work, because proper OS integration on OS X also requires that you get the basic AppleScript hooks right; WxWidgets和Qt在OS X上看起来都是正确的,但除非你做了一些额外的工作,否则不能正常工作,因为在OS X上正确的OS集成也需要你正确地获得基本的AppleScript挂钩; OS X uses these for many common system GUI actions, so you need them to get (for example) drag-and-drop onto your dock icon working. OS X将这些用于许多常见的系统GUI操作,因此您需要它们(例如)拖放到Dock图标上。

Personally I prefer Qt over WxWidgets by faaarrrr. 就个人而言,我更喜欢Qt而不是faaarrrr的WxWidgets。 wxWidgets' API just feels like another MFC ... much too clumsy for my liking. wxWidgets的API感觉就像另一个MFC ......对我来说太笨拙了。 Qt, on the other hand, is a lot closer to what writing apps in modern C++ should be like, not to mention its excellent QtDesigner (okay, wxWidgets has wxFormBuilder, but last time I checked it wasn't anywhere near as good as QtDesigner). 另一方面,Qt更接近于现代C ++中应用程序的编写应该是什么样的,更不用说它优秀的QtDesigner(好吧,wxWidgets有wxFormBuilder,但上次我检查它并不像QtDesigner那么好)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM