Sign in Join
Wiki copytemporary

Qt5 Interface: what changed

Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-*(Qt only)*
2-
3-## Introduction
4-
5-This interface is based on Qt 5 (Qt 5.6.2 is tested). For documentation, fixes and download, go to [Qt Project](http://qt-project.org/) (Installers at [download 5.6.2](https://download.qt.io/new_archive/qt/5.6/5.6.2/)). Lazarus with Qt5 interface (qt5-lcl) can be used on Windows 32/64, Linux x32/x64/arm, macOS x64 (Cocoa). Qt5 widgetsets have been available in Lazarus from 1.8 stable release.
6-
7-Most current Linux distros have a suitable Qt5 in their standard repositories however, long term support releases have issues due to their age. Ubuntu 16.04 has QT5.5 that is too old and 18.04 ships a problematic version of *libQt5Pas* that needs to be replaced, see below. Nice [howto](https://github.com/zoltanleo/fpc_lazarus_notes/blob/main/README_ENG.md#installing_qt_lazarus)by forum user zoltanleo (suitable for qt6 also).
8-
9-## Windows
10-
11-There is a *Q5Pas1.dll* binary available.
12-
13-- x86: <https://gitlab.com/freepascal.org/lazarus/binaries/-/raw/main/i386-win32/qt5/Qt5Pas1.dll?inline=false>
14-
15-no 64-bit version yet.
16-
17-The build is based on MinGW, thus you want to use the MinGW Qt library (i.e. qt-opensource-windows-x86-mingw492-5.6.2.exe).
18-
19-If you need to build **cbindings** project, you need **MinGW**. You can use **MinGW** from the Qt package (qt-opensource-windows-x86-mingw492-5.6.2.exe) - it's an optional component of Qt package installation.
20-
21-### Running and Deployment
22-
23-The project needs to be deployed with *Q5Pas1.dll*.
24-
25-For Qt5 .dlls that should be deployed, see Qt5 guides: <https://doc.qt.io/qt-5/windows-deployment.html>.
26-
27-For MinGW based package the following set of DLLs would be required to run a single FORM project.
28-
29-Those DLLs come with Qt5 package (can be found at C:\Qt\Qt5.6.2\5.6\mingw49_32\bin).
30-
31-
32-Qt5Core.dll
33-
34-Qt5PrintSupport.dll
35-
36-Qt5Widgets.dll
37-
38-Qt5Gui.dll
39-
40-Qt5Network.dll
41-
42-libstdc++-6.dll
43-
44-libwinpthread-1.dll
45-
46-libgcc_s_dw2-1.dll
47-
48-Builds based on MSVC rather than MinGW might have different set of (non Qt5) dlls required. Note that [Qt5Pas1.dll](https://gitlab.com/freepascal.org/lazarus/binaries/-/raw/main/i386-win32/qt5/Qt5Pas1.dll?inline=false) is built against Qt5-5.6.2, but Qt5Pas1.dll can be used with any Qt5 \> 5.6.2.
1+[![Qt logo.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Qt_logo_2013.svg/60px-Qt_logo_2013.svg.png)](</File:Qt_logo_2013.svg>)
492
50-## Linux
3+This article applies to [Qt5 widgetset](</Category:Qt> "Category:Qt") only.
514
52-### Lazarus
5+See also: [[Multiplatform Programming Guide]]
536
54-![Image of Qt5 selected](/wiki-images/4/46/SelectQt5.png)Lazarus "out of the box" on Linux uses and makes apps for GTK2. It is not marked as having a dependency on Qt5 so if you wish to make Qt5 apps or build a Qt5 version of Lazarus you probably will need to install *libQt5Pas-dev*, Using your distros repository:
7+Lazarus "out of the box" on Linux uses and makes apps for GTK2. It is not marked as having a dependency on Qt5 so if you wish to make Qt5 apps or build a Qt5 version of Lazarus you probably will need to install _libQt5Pas-dev_ , Using your distros repository (see below) :
558
56-- Fedora, Mageia - sudo dnf install qt5pas-devel \<enter\>
57-- Ubuntu, Debian - sudo apt install libqt5pas-dev \<enter\>
9+ * Fedora, Mageia - sudo dnf install qt5pas-devel <enter>
10+ * Ubuntu, Debian - sudo apt install libqt5pas-dev <enter>
11+ * Arch type systems - sudo pacman -S --needed qt5pas <enter>
5812
59-it will bring along the necessary Qt5 libraries as dependencies, typically about 50Meg on a system that has no existing Qt5 needs. If you wish to use a Qt5 version of Lazarus, build from source with a command like "make bigide LCL_PLATFORM=qt5 \<enter\>" but note the default GTK2 Lazarus is quite happy to build Qt5 apps for you.
13+it will bring along the necessary Qt5 libraries as dependencies, typically about 50Meg on a system that has no existing Qt5 needs. If you wish to use a Qt5 version of Lazarus, build from source with a command like "make bigide LCL_PLATFORM=qt5 <enter>" but note the default GTK2 Lazarus is quite happy to build Qt5 apps for you.
6014
61-From within Lazarus, to choose to build a Qt5 app, Projects-\>ProjectOptions-\>AdditionsandOverrides and click Set "LCLWidgetType", and select Qt5 for the current Build Mode. Better yet, add a special build mode for Qt5, maybe a release and debug.
15+From within Lazarus, to choose to build a Qt5 app, Projects->ProjectOptions->AdditionsandOverrides and click Set "LCLWidgetType", and select Qt5 for the current Build Mode. Better yet, add a special build mode for Qt5, maybe a release and debug.
6216
63-> **Note:** that if you install Lazarus using you distribution's version of Lazarus, you may need to specifically ask for the Qt5 LCL components. If installing from source, you will get the lot right from the start.
17+Note : that if you install Lazarus using you distribution's version of Lazarus, you may need to specifically ask for the Qt5 LCL components. If installing from source, you will get the lot right from the start.
6418
65-Don't forget, when releasing your app, it should be marked as being dependent on libqt5pas1.
19+Don't forget, when releasing your app, it should be marked as being dependent on libqt5pas1. Further, as detailed below, your app may need a more current libqt5pas than the one in your end user's system.
6620
6721### libqt5pas
6822
69-*libqt5pas* is a library that bridges between Qt5 and your Lazarus application. Newer distros (U20.04, Debian Buster etc) have working versions available in their repositories. Mark you application as dependent on libqt5pas1 and all will be OK. You, as a developer using Qt5 will also need libqt5pas-dev as mentioned above.
70-
71-> **Note:** if you are using a version of Lazarus later than 2.2.0 you (and your end users) will need libQt5Pas greater or equal to 1.2.10. It will take some time for the distributions to update the version they distribute, so either build your own or use the unofficial <https://github.com/davidbannon/libqt5pas/releases/latest> debs and rpms as mentioned below. Remember, your end users need 1.2.10 too !
72-
73-Using your distros repository -
23+**Note | At the time of writing, March 2025, the current libQt5Pas is V1.2.16. A project built with any recent Lazarus will need at least V1.2.15 and on some distros (due to the version of Qt5 they use) that is V1.2.16.**
7424
75-- Fedora, Mageia - sudo dnf install qt5pas\<enter\>
76-- Ubuntu, Debian - sudo apt install libqt5pas1 \<enter\>
25+_libqt5pas_ is a library that bridges between Qt5 (or in the case of libqt6pas, Qt6) and your Lazarus application. Mark you application as dependent on libqt5pas1 and all will be OK. You, as a developer using Qt5 will also need libqt5pas-dev as mentioned above.
7726
78-#### Do I have a problem with the version ?
27+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** if you are using a current version of Lazarus, you (and your end users) will need a current libQt5Pas. Most distros have a libqt5Pas in its repo that was released just before the distro version was released. So you need to build your own current libqt5Pas or use the unofficial <https://github.com/davidbannon/libqt5pas/releases/latest> packages as mentioned below. Remember, your end users need a current library too ! Newer distros (U24.04, Debian Trixie, most Arch based) have working versions available in their repositories.
7928
80-The version of libQt5Pas will cause concern to the following people, remember this affects you as a developer AND your end users.
29+Using your distros repository -
8130
82-- Very Old Linux distribution users, such as Ubuntu 16.04 - sorry, no solution, do not use Qt5 if you need support such Operating Systems.
83-- Old Linux Distributions such as U18.04, still officially supported until 2023 but uses an inadequate libQt5Pas. You will see a crash if your application uses TMemo. Replace the existing libQt5Pas.
84-- Current LTS distributions like Ubuntu 20.04, 22.04, Debian Bullseye etc will have libQt5Pas earlier than 1.2.10 (1.2.6) and thats a problem if you use a Lazarus version later than 2.0.12. Again, you can replace the existing libQt5Pas
31+ * Fedora, Mageia - sudo dnf install qt5pas<enter>
32+ * Ubuntu, Debian - sudo apt install libqt5pas1 <enter>
33+ * Pacman system - sudo pacman -S --needed qt5pas <enter>
8534
86-You can check the libQt5Pas package version in human-friendly form by issueing this command: `ls -al libQt5Pas.so*` in the following folder:
35+You can check the libQt5Pas package version in human-friendly form by issuing this command: `ls -al libQt5Pas.so*` in the following folder:
8736
8837On Debian / Ubuntu variants: `/usr/lib/x86_64-linux-gnu`
8938
9039On Raspberry OS: `/usr/lib/arm-linux-gnueabihf`
9140
92-**Replace your libQt5Pas ?**
93-
94-Two options, use a deb or rpm from <https://github.com/davidbannon/libqt5pas/releases/latest> - you might need to ensure your Package Manager does not object or, even, replace your bright shiny new one with its preferred distro one. Shout out on the Forum if you need something other than just the 64bit debs and RPMs there (Signing, 32bit, Pacman etc). Install with, eg, sudo apt install ./libqt5pas1_2.10-0_amd64.deb \<enter\>. As a developer, you will also need the -dev package, remove an existing one if present.
95-
96-Secondly, the Lazarus source has the code to build your own, you will need gcc and a few other things, documented in the README.txt. Then copy the new library over top of your existing libQt5Pas1 (as root of course)
41+### Replace your libQt5Pas ?
9742
98-Note 1 that these two deb packages are made for Ubuntu 18.04 (or later), they will not help at all on Ubuntu 16.04 as its main Qt5 libraries are too old.
43+**Build your own.** The Lazarus source has the code to build your own, you will need gcc and a few other things, documented in the README.txt. Then copy the new library over top of your existing libQt5Pas1 (as root of course).
9944
100-Note 2 Ubuntu will constantly overwrite this pair of updated packages via it's 'unattended update' tool. You must blacklist the packages to force the unattended update tool from undoing your good work.
45+**Download an unofficial package.** You find deb, rpm and tarball packages at <https://github.com/davidbannon/libqt5pas/releases/latest> for Intel and Arm 32bit and 64bit. You might need to ensure your Package Manager does not object or, even, replace your bright shiny new one with its preferred distro one. Raise a (github) issue or shout out on the Forum if you need something other than the ones there now. Install with the usual commands for your distro (remembering to always put a ./ ahead of the package name, else the installer tries to get it from its repo). As a developer, you will also need the -dev (or -devel) package, remove an existing one if present.
10146
10247### Systems using Wayland
10348
104-Some distributions use Wayland by default (e.g. the default Fedora with a GNOME desktop) and Qt5 does not work with Wayland. You will receive a message like:
105-
106- QSocketNotifier: Can only be used with threads started with QThread
49+Some distributions use Wayland by default (e.g. the default Fedora with a GNOME desktop) and Qt5 does not work with Wayland. You will receive a message like:
50+```
51+QSocketNotifier: Can only be used with threads started with QThread
10752 [FORMS.PP] ExceptionOccurred
10853 ....
54+```
10955
110-Logout, from the login screen click the small gear symbol, select "GNOME on XOrg". Log back in again.
56+Logout, from the login screen click the small gear symbol, select "GNOME on XOrg". Log back in again.
11157
11258There is, apparently a Wayland plugin for Qt5, for the brave - <https://wayland.freedesktop.org/qt5.html>
11359
11460### Qt5 Colours
11561
116-On Linux, sometimes Qt5 apps will inherit the colours it uses from the Desktop/OS. However this does not always work and appears to be Distribution / Desktop dependent. With the current fad of Dark Themes, a more reliable approach is to use qt5ct. qt5ct appears to be in most distribution's repository and is a quick and easy install. When you run it, it opens on the "Appearance" tab, for a Dark Theme, choose Palette = Custom, Color Scheme = Darker. Click "Apply" and "OK" to close the app.
117-
118-![](/wiki-images/6/6d/Qt5ct_dark.png)
62+On Linux, sometimes Qt5 apps will inherit the colours it uses from the Desktop/OS. However this does not always work and appears to be Distribution / Desktop dependent. With the current fad of Dark Themes, a more reliable approach is to use qt5ct. qt5ct appears to be in most distribution's repository and is a quick and easy install. When you run it, it opens on the "Appearance" tab, for a Dark Theme, choose Palette = Custom, Color Scheme = Darker. Click "Apply" and "OK" to close the app.
11963
120-Did you note the message across the top, "The application is not configured correctly" ? What it is worried about is that you have not added the environment variable setting that will tell your app to use the colours you just set. You can set it for just one application by setting it in the application's command line :
64+[![qt5ct dark.png](/wiki-images/f/f1/qt5ct_dark.png)](</File:qt5ct_dark.png>)
12165
122- QT_QPA_PLATFORMTHEME=qt5ct myapplication
66+Did you note the message across the top, "The application is not configured correctly" ? What it is worried about is that you have not added the environment variable setting that will tell your app to use the colours you just set. You can set it for just one application by setting it in the application's command line :
67+```
68+QT_QPA_PLATFORMTHEME=qt5ct myapplication
69+```
12370
124-That may be added to the app's Desktop file or maybe you edit the menu entry. The alternative is to add it /etc/environment (obviously without the application's name) so it is automatically set for all apps, you need to logout and back in again. Adding an entry into your own .bashrc is not quite appropriate in that GUI apps started from the menu for example will not be told about it. Note: On Debian installing qt5ct automatically add QT_QPA_PLATFORMTHEME to environment variables.
71+That may be added to the app's Desktop file or maybe you edit the menu entry. The alternative is to add it /etc/environment (obviously without the application's name) so it is automatically set for all apps, you need to logout and back in again. Adding an entry into your own .bashrc is not quite appropriate in that GUI apps started from the menu for example will not be told about it. Note: On Debian installing qt5ct automatically add QT_QPA_PLATFORMTHEME to environment variables.
12572
12673### Why Qt5 instead of GTK ?
12774
128-Good question ! Most Linux Lazarus applications are built using the default GTK2. The various Linux distributions are delivering fewer and fewer GTK2 apps, generally 'upgrading' to GTK3. However, the Lazarus GTK3 interface still needs some work and its not ready for production systems yet. Until late 2019, this has not mattered much, GTK2 works fine. But Ubuntu19.10 does not have GTK2 libraries installed by default and Xfce has announced its next release will be GTK2 free, apparently many distributions are looking to drop GTK2 from their default kits. While you can still install GTK2, its pretty big....
75+Good question ! Most Linux Lazarus applications are built using the default GTK2. The various Linux distributions are delivering fewer and fewer GTK2 apps, generally 'upgrading' to GTK3. However, the Lazarus GTK3 interface still needs some work and its not ready for production systems yet. Until late 2019, this has not mattered much, GTK2 works fine. But Ubuntu19.10 does not have GTK2 libraries installed by default and Xfce has announced its next release will be GTK2 free, apparently many distributions are looking to drop GTK2 from their default kits. While you can still install GTK2, its pretty big....
12976
130-Qt5 is an obvious solution, its already installed on distros like Fedora 30 plus, its a relatively lightweight addition to Ubuntu, only 48Meg compared with GTK2's 445Meg. If you mark your application dependent on libqt5pas then it will be installed at the same time, bringing along the other qt5 files if necessary. Manually installing libqt5pas with your package manager (as long as it resolves dependencies!) will also work.
77+Qt5 is an obvious solution, its already installed on distros like Fedora 30 plus, its a relatively lightweight addition to Ubuntu, only 48Meg compared with GTK2's 445Meg. If you mark your application dependent on libqt5pas then it will be installed at the same time, bringing along the other qt5 files if necessary. Manually installing libqt5pas with your package manager (as long as it resolves dependencies!) will also work.
13178
132-Clearly, Qt based distributions, ones using Plasma or KDE as a desktop will require only *libqt5pas*.
79+Clearly, Qt based distributions, ones using Plasma or KDE as a desktop will require only _libqt5pas_.
13380
13481## macOS (64-bit)
13582
136-The following steps have been tested with macOS 10.13.6 (High Sierra), Xcode command line tools 10.0.0 (no Xcode required), Lazarus 1.8.4 and minimum Qt 5.6.2 (Qt 5.12.xx works without problems too).
137-
138-After installing Qt 5.6.2 (see above), open up a terminal window and run these commands (paths may vary):
83+The following steps have been tested with macOS 10.13.6 (High Sierra), Xcode command line tools 10.0.0 (no Xcode required), Lazarus 1.8.4 and minimum Qt 5.6.2 (Qt 5.12.xx works without problems too).
13984
140- export LazarusDir=/Developer/Lazarus
85+After installing Qt 5.6.2 (see above), open up a terminal window and run these commands (paths may vary):
86+```
87+export LazarusDir=/Developer/Lazarus
14188 export QtDir=~/Qt5.6.2
14289 cd $LazarusDir/lcl/interfaces/qt5/cbindings
14390 export PATH=$QtDir/5.6/clang_64/bin:$PATH
14491 qmake
145-
146-**If `qmake` fails** with the following error:
147-
148- xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
92+```
14993
150-**it does not** mean that you have to install Xcode. See [Qt without Xcode](https://gist.github.com/shoogle/750a330c851bd1a924dfe1346b0b4a08) for a workaround and try running `qmake` again. (The Xcode dependency seems to be fixed in Qt 5.9.4 or maybe earlier.)
94+**If`qmake` fails** with the following error:
95+```
96+xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
97+```
15198
152-Proceed the build process with the following commands:
99+**it does not** mean that you have to install Xcode. See [Qt without Xcode](<https://gist.github.com/shoogle/750a330c851bd1a924dfe1346b0b4a08>) for a workaround and try running `qmake` again. (The Xcode dependency seems to be fixed in Qt 5.9.4 or maybe earlier.)
153100
154- make
101+Proceed the build process with the following commands:
102+```
103+make
155104 make install
156-
157-It may be helpful to add symlinks to the Qt5Pas.framework and other *.framework files (so no modifications to the path are required):
105+```
158106
159- cd /Library/Frameworks/
107+It may be helpful to add symlinks to the Qt5Pas.framework and other *.framework files (so no modifications to the path are required):
108+```
109+cd /Library/Frameworks/
160110 sudo ln -s $QtDir/5.6/clang_64/lib/*.framework .
161-
162-Remember that Qt5 is 64 bit, so in Lazarus under Tools - Options - Environment, you need to change Compiler Executable from `/usr/local/bin/ppc386` to `/usr/local/bin/ppcx64` . With ppc386, you would later get the following errors when compiling your Lazarus projects:
111+```
163112
164- Error: linker: Undefined symbols for architecture i386:
113+Remember that Qt5 is 64 bit, so in Lazarus under Tools - Options - Environment, you need to change Compiler Executable from `/usr/local/bin/ppc386` to `/usr/local/bin/ppcx64` . With ppc386, you would later get the following errors when compiling your Lazarus projects:
114+```
115+Error: linker: Undefined symbols for architecture i386:
165116 Error: linker: "_QAbstractButton_click", referenced from:
166117 [...]
167118 ld: symbol(s) not found for architecture i386
119+```
168120
169-Finally, create a new Lazarus project (or open an existing one), open Project - Project options - Compiler options - Additions and overrides, set `LCLWidgetType:=qt5` . You should now be able to compile your project with the Qt5 widget set.
121+Finally, create a new Lazarus project (or open an existing one), open Project - Project options - Compiler options - Additions and overrides, set `LCLWidgetType:=qt5` . You should now be able to compile your project with the Qt5 widget set.
170122
171123## Example Project
172124
173-See [First Steps with Lazarus Qt5 interface](https://tondrej.blogspot.com/2018/04/first-steps-with-lazarus-qt5-interface.html) for an example project for Win32, Win64, macOS (64 bit) and Linux (64 bit).
125+See [First Steps with Lazarus Qt5 interface](<https://tondrej.blogspot.com/2018/04/first-steps-with-lazarus-qt5-interface.html>) for an example project for Win32, Win64, macOS (64 bit) and Linux (64 bit).
174126
127+## Other Interfaces
128+
129+ * [[Lazarus known issues \(things that will never be fixed\|Lazarus known issues (things that will never be fixed)]]> "Lazarus known issues \(things that will never be fixed\)") \- A list of interface compatibility issues
130+ * [[Win32/64 Interface]] \- The Windows API (formerly Win32 API) interface for Windows 2000/XP/Vista/10, but not CE
131+ * [[Windows CE Interface]] \- For Pocket PC and Smartphones
132+ * [[Carbon Interface]] \- The Carbon 32 bit interface for macOS (deprecated; removed from macOS 10.15)
133+ * [[Cocoa Interface]] \- The Cocoa 64 bit interface for macOS
134+ * [[Qt Interface]] \- The Qt4 interface for Unixes, macOS, Windows, and Linux-based PDAs
135+ * Qt5 Interface \- The Qt5 interface for Unixes, macOS, Windows, and Linux-based PDAs
136+ * [[GTK1 Interface]] \- The gtk1 interface for Unixes, macOS (X11), Windows
137+ * [[GTK2 Interface]] \- The gtk2 interface for Unixes, macOS (X11), Windows
138+ * [[GTK3 Interface]] \- The gtk3 interface for Unixes, macOS (X11), Windows
139+ * [[fpGUI Interface]] \- Based on the fpGUI library, which is a cross-platform toolkit completely written in Object Pascal
140+ * [[Custom Drawn Interface]] \- A cross-platform LCL backend written completely in Object Pascal inside Lazarus. The Lazarus interface to Android.
141+
142+### Platform specific Tips
143+
144+ * [[Android Programming]] \- For Android smartphones and tablets
145+ * [[iPhone/iPod development]] \- About using Objective Pascal to develop iOS applications
146+ * [[FreeBSD Programming Tips]] \- FreeBSD programming tips
147+ * [[Linux Programming Tips]] \- How to execute particular programming tasks in Linux
148+ * [[macOS Programming Tips]] \- Lazarus tips, useful tools, Unix commands, and more...
149+ * [[WinCE Programming Tips]] \- Using the telephone API, sending SMSes, and more...
150+ * [[Windows Programming Tips]] \- Desktop Windows programming tips
151+
152+### Interface Development Articles
153+
154+ * [[Carbon interface internals]] \- If you want to help improving the Carbon interface
155+ * [[Windows CE Development Notes]] \- For Pocket PC and Smartphones
156+ * [[Adding a new interface]] \- How to add a new widget set interface
157+ * [[LCL Defines]] \- Choosing the right options to recompile LCL
158+ * [[LCL Internals]] \- Some info about the inner workings of the LCL
159+ * [[Cocoa Internals]] \- Some info about the inner workings of the Cocoa widgetset
160+
175161---
176-*From the Free Pascal wiki, page "Qt5 Interface", as it stood on 2023-05-01 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
162+*From the Free Pascal wiki, page "Qt5 Interface", as the Internet Archive kept it on 2026-01-02, last changed on 2025-03-08. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history