Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

Ask HN: What's the best library for making cross-platform UIs?

$
0
0

It would help a lot to have the question elaborate on what you really need. What do you mean by "best", and do you actually need the best? Do you need easy to learn, or code that is easy to deliver, or most powerful features, or most number of platforms covered? Do you include mobile in cross platform, and do you have a performance or language requirement?

A web app is one of the most cross platform ways to go, is the easiest to deliver, and can be easy-ish to learn, but isn't the easiest. But, you are stuck with JavaScript. If a web app won't work for you, why not? Knowing that will allow people to help you more.

Qt is great, especially if you're using C++ or some other language. It's pleasant and very powerful, but a lot to learn, and deployment to users is harder than a web app.

What are your constraints & requirements?


Strange nobody mentioned wxWidgets so far which gives you true native apps, so I'll do it:

http://wxwidgets.org

It provides API layer which compiles to Win32 API on Windows, Gtk2 on Linux and Carbon/Cocoa on Mac OSX.

Qt only emulates Windows controls, but wxWidgets uses the actual Windows controls via Microsoft Win32 API.

BTW, there's wxQt, a wxWidgets implementation that uses Qt instead of Gtk, but it's still experimental:

https://wiki.wxwidgets.org/WxQt

wxWidgets has been used by some popular projects like Audacity, TortoiseCVS, RapidSVN, FileZilla, BitTorrent, etc.

Another wxWidgets advantage over Qt is the license, which gives you more freedom.

If you're looking for a faster start, take a look at wxFormBuilder which is a graphical WYSIWYG UI editor where you can drop controls in windows/dialogs and hook up event handlers.

You can find links to more related tools/IDEs on the Wikipedia page:

https://en.wikipedia.org/wiki/WxWidgets


We have chosen Qt for our new cross-platform app (Android, Windows, MacOS) which we've developed for the past 1.5 years and have overall not regretted it. Doing UIs with QML and Qt Quick is so much faster than Android's XML based system and gives you a lot of flexibility.

However there's a bit of a UI rendering overhead, although I understand they made it faster with Qt 5.7. And OpenGL integration is more complicated than doing it natively since you have to understand Qt's UI scene graph system and the way Qt is threading things.

But overall it's been a good choice so far.


It depends on what you mean by, "cross-platform." In my world there is no such thing. You pick your target platforms and program to them. However it is common to imply "major platforms" (ie: iOS, Android, Windows 10, OSX). Different platforms have different requirements and will shape your solution.

Next... what is the application? Do you need to target native APIs? Do you have memory limitations?

If you don't mind taking up a lot of memory try one of the "cross platform" systems like Xamarin or some Java-based solution. If you need to be more constrained try writing to the native APIs and porting your project to each target platform you need to target. Lastly if you're highly constrained maybe you need to try an immediate-mode style library like Nuklear[0].

It really depends on your needs. There's no one-size-fits-all.

[0] https://github.com/vurtun/nuklear


What counts as the best depends on your exact requirements but three good options to get a GUI off the ground quickly are Tk [1], wxWidgets (and wxPython [2] and wxLua [3] in particular) and Lazarus (LCL) [4].

Tk widgets look native on Windows and macOS, though their behavior is implemented by Tk itself. On Linux it draws it own widgets in several styles; GTK and Qt theme support is immature. Lazarus and wxWidgets use native widgets on Windows and macOS. Both can use GTK2 on Linux but Lazarus also supports GTK1 and Qt.

If I had to deliver a cross-platform desktop GUI application by midnight today, I would go with Tk, write the code in Tcl (which necessarily has the best Tk integration) and package it in a static binary Starpack [5].

[1] http://www.tkdocs.com/

[2] https://wxpython.org/

[3] http://wxlua.sourceforge.net/

[4] http://www.lazarus-ide.org/, http://wiki.lazarus.freepascal.org/LCL

[5] https://tcl.wiki/Starpack


If you don't want a _native_ GUI, you can go the Electron way. This way you'll have a fully cross-platform application with minimum hassle.

If you want a native one, probably Qt is the winner here.


I've recently been using Crank Storyboard and I've been off to a good start. You can run it on embedded devices like ARM Cortex-M series processors, or Linux, iOS, Android, Windows, with openGL support. It does require a license though.

http://cranksoftware.com/storyboard-suite

Also someone else mentioned Phonegap and using HTML/JS. I think is a good option but it depends on what your app does and if you're doing mobile app design.

I have not used QT yet, but after doing some research, it's kind of a pick your poison type of choice, IMO.


Depends on what you're after :)

Electron or QT for cross-desktop apps, Angular & Ion framework for cross-mobile apps, React & React-native for cross-mobile apps


JUCE is a great framework, has a very commendable coding style and is easy to get into. One thing to note is that the "JUCE way" of doing things is to have a UI that looks exactly the same on every platform - this is good for predictability, but if you want a UI that looks native, you're better off using Qt or wxWidgets (as C++ UI toolkits go).

In many cases I'd say that's not an issue, and JUCE is underrated/underused as a general-purpose UI toolkit.


Well, commendable means "deserving praise", and when working with it, I generally appreciated the simplicity, consistency, and clarity I found throughout the JUCE codebase.

It also encourages you to adopt a coding style that's consistent with the rest of JUCE, particularly in terms of memory management. This is one of the things that makes it a lot more "framework" than "library", and again might not be for everyone. Take a look at the "Object lifetime and ownership" section in this page:

https://www.juce.com/learn/coding-standards


+1, because I had the urge to say the same thing.

I think the question needs to be a lot more specific about the type of app and the platforms it needs to run on. Web-based applications give you the broadest reach for the lowest cost if you can assume internet connectivity and if the GUI that's possible from within the browser sandbox is sufficient for your needs. (Capabilities are growing all the time, but it's still not the same as native.) If your app needs to be offline, it's still possible with web tech but it's harder to justify, unless you're doing a hybrid of online and offline and the online part isn't just service calls.


Take a look at Free Pascal and the Lazarus IDE.

What is a Lazarus? From their website:

"...a cross-platform IDE for Rapid Application Development. It has variety of components ready for use and a graphical form designer to easily create complex graphical user interfaces."

Why use Lazarus and Free Pascal? You can create native, cross-platform UI's all combined into a single, fast, low-memory executable that can easily be deployed and distributed on different platforms.

http://www.lazarus-ide.org/


Depending on the type of UI, you could also give Kivy a try.https://kivy.org/

It's python based, and really easy to get going. It does have it's quirks, but overall I found it a joy to use.


No idea why you're being downvoted.

QT refers to Apple's Quick Time.

Qt refers to the Qt project, pronounced 'cute'.


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>