Forum > Linux

GTK or QT?

(1/6) > >>

bitman:
Hi everyone, I'm new to the forum and to Lazarus in general, though I've got some experience with Pascal and Delphi.

I need to develop an app that needs to run on Linux, Windows and mac.  I will be developing solely on Linux, and my plan is to just recompile on Windows and mac later on.

I noticed that Lazarus on Linux works under the hood using either Gtk2 or QT. As a matter of fact, I think I installed the QT implementation in a Debian/KDE machine, while on another system with Solus/Budgie I believe I installed the Gtk version.

So, my question is: which one should I use (GTK or QT) so that it gives me the less problems later on when I try to recompile for Windows and Mac ??? Or doesn't make any difference? Should I just install the version that merely corresponds to the linux desktop I'm using at the moment (Plasma or budgie)?

Thanks in advance!

MarkMLl:
I can't really speak for the Windows/Mac side of things, but my experience on Linux (mainly Debian) is that there are few issues compiling for /both/ GTK2 and Qt. Where you /do/ come across problems, e.g. if you're trying to do fancy stuff with keycodes or define control placement better than can be managed with anchors etc., I think I'd argue that if you isolate them early by regularly checking with multiple widget sets on the same platform then it will likely save you work when you migrate to a different one.

MarkMLl

zeljko:
I'm using Qt on Linux, Windows and Mac for years and it suits all my needs. You must decide on your own what is better on Linux for you, gtk2 is usually installed by default, but gtk2 won't be default installation for so long time since it's pretty old lib now. Gtk3 widgetset isn't finished, on the other side we have Qt and Qt5 WS - stable and continuosly developed and maintaned. My recommendation is definitelly Qt5 if you start fresh project and need stable WS since all distros now pack libQt5Pas C library which is needed by Qt5 WS.

PascalDragon:

--- Quote from: bitman on September 04, 2021, 07:36:48 am ---So, my question is: which one should I use (GTK or QT) so that it gives me the less problems later on when I try to recompile for Windows and Mac ??? Or doesn't make any difference? Should I just install the version that merely corresponds to the linux desktop I'm using at the moment (Plasma or budgie)?
--- End quote ---

For Windows and macOS neither Gtk nor Qt are used (by default). For Windows the WinAPI is used directly and for macOS Cocoa is used. So there might be slight differences between platforms anyway so it's recommended that you test your application on these platforms.

dbannon:
Yes, as previously said, you really only need to choose between GTK2 and Qt5 on Linux, on Windows you will use Win32 and on Mac, its Cocoa.

If you mean which of GTK2, Qt5 is easier to translate to Windows or mac, neither, in my app, I make both a Qt5 and GTK2 version for Linux and just recompile to be Windows or mac.  Very occasionally you might need to put a ifdef in because one widget set or another needs slightly different treatment. But you will have  more (but still not a lot) of ifdefs dealing with other differences between platforms, not related to widget set.

I do occasionally get feedback from my Linux users that they prefer the look of the QT5 set, its trivial to produce either so build something and see what you prefer the look of.

Davo

Navigation

[0] Message Index

[#] Next page

Go to full version