Which, if any, achieves Windows native look: GTK+, wxWidgets, Qt, FLTK?

前端 未结 4 2084
北恋
北恋 2021-01-31 03:21

I need to write an application that will be visually indistinguishable from something written natively for Windows XP/Vista/7 using whatever comes by default wi

4条回答
  •  爱一瞬间的悲伤
    2021-01-31 03:40

    I won't talk about FLTK as I don't know it.

    • wxWidgets uses the native toolkit of the platform, (GTK on Linux, Win32 GUI API on Windows, Cocoa on MacOS X).
    • GTK uses a theming API to fake the look and feel of the platform (custom theming engine on GTK2, CSS-based engine on GTK3).
    • Qt uses styles to fake the look and feel of the platform.

    wxWidgets API is quite ugly from my own experience, because it had too many method just available on one or the other platform making stuff non-portable unless you'd workaround it. Unlike GTK+ and Qt, it also adds its own layer of bugs above the toolkit it uses as a backend. However, it tries hard to have the platform's native look as it uses the native toolkit.

    GTK+ 3 still has some rough edges on Windows, which it officially supports since GTK+ 3.6. The GTK+ project delegates to the MSYS2 project the distribution of Windows binaries. As you're already using MinGW, that's pretty much the same kind of environment. They have good C++ bindings with GTKmm. However, you may have some work to get the theming right for your version of Windows.

    Qt is a good choice for cross-platform C++ development with the main target being Windows, tries to mimic the native look and feel of the platform but has its own theming limitations too.

    To sum up, there are only 2 approches:

    • toolkits that provide their own widgets and try to look like the native platform by providing theming (GTK+ and Qt)
    • toolkits that use the native widgets but hide their API behind a layer of abstraction (wxWidgets)

    Both have their pros and cons.

提交回复
热议问题