Recent

Author Topic: How to use Qt5 with Lazarus-IDE 1.8?  (Read 10911 times)

İbrahim

  • New Member
  • *
  • Posts: 19
How to use Qt5 with Lazarus-IDE 1.8?
« on: December 20, 2017, 02:17:08 pm »
Hi. I downloaded fpc-3.0.4, fpc-src and Lazarus-IDE 1.8. I installed Lazarus and when I started Lazarus-IDE, I see Lazarus is using x86_64-linux-gtk2. I want to use Qt5 for Lazarus interface. How can I do it? Thanks.

turrican

  • Full Member
  • ***
  • Posts: 133
  • Pascal is my life.
    • Homepage
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #1 on: December 20, 2017, 03:31:40 pm »
Hi,

Projects -> Project Options -> Additions & Overrides -> Set "Value qt5"
« Last Edit: December 20, 2017, 03:38:21 pm by turrican »

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #2 on: December 20, 2017, 03:41:54 pm »
What turrican said is for changing the Project's widgetset. For changing the IDE's widgetset you need to change the setting here:
Lazarus main menu > Tools > Configure "Build Lazarus"

For Qt5, you may fail on first attempt. Because you need to prepare the binding as mentioned here:
http://wiki.lazarus.freepascal.org/Roadmap#General_status_of_LCL_interfaces

You may need to search the web for how to do Qt5 binding.

OH1KH

  • Jr. Member
  • **
  • Posts: 63
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #3 on: March 21, 2018, 06:58:14 pm »
HI !

Could someone give detailed instructions for Fedora26 and QT5 usage, please?

I selected  Projects -> Project Options -> Additions & Overrides -> Set "Value qt5" and compile stops to linking error.

Assume it is because of bindings. Wiki says:
Bindings sources are located in lcl/interfaces/qt5/cbindings , to build it just follow README.txt.

Found them from /usr/lib64/lazarus/lcl/interfaces/qt5/

But readme there says:
To use them you also need to download and install
at appropriate place the libQt5Pas.so (linux)

"dnf provides */libQt5Pas.so" does not found anything,
Same with googling. No file or library named like that within Fedora releases. Fedora is known using bit different naming, but could not guess anything that fits.

Closest hit with google was found  from this forum:

Hi

I've recently installed Fedora 26 with KDE 5 and QT 5.6 on a new system. I managed to build and install libQt5Pas.so as per the wiki and rebuild Lazarus for QT5.

But "as per wiki" says nothing valuable to me. A'm I looking for wrong wiki?


--
Saku

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #4 on: March 21, 2018, 07:32:25 pm »
I don't know much about Qt, but I found some info that maybe can help.

The README.txt on my Lazarus 1.8.0 Ubuntu is found at:
/usr/share/lazarus/1.8.0/lcl/interfaces/qt

And this is what it says:
These are the sources of the LCL qt interface.
They only work with qt4 or superior.

To use them you also need to download and install
at appropriate place the libQt4Pas.so (linux)
or Qt4Pas.dll (ms windows) or Qt4Pas.framework (Darwin).

For more information see:
http://wiki.lazarus.freepascal.org/index.php/Qt_Interface


And the wiki page says:
... The first thing to do is go to the official website of the bindings and download the binary Qt bindings. ...

Note:
The link of the "official website" is
http://users.pandora.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html

But "as per wiki" says nothing valuable to me. A'm I looking for wrong wiki?

Which wiki you're reading?
« Last Edit: March 21, 2018, 07:37:54 pm by Handoko »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #5 on: March 21, 2018, 08:01:32 pm »
Assume it is because of bindings. Wiki says:
Bindings sources are located in lcl/interfaces/qt5/cbindings , to build it just follow README.txt.

Found them from /usr/lib64/lazarus/lcl/interfaces/qt5/

But readme there says:
To use them you also need to download and install at appropriate place the libQt5Pas.so (linux)
I don't think you can download it from anywhere now. You must build it yourself. Zeljko, the author, should clarify the documentation. I don't remember the details now.
In any case with QT5 you should use Lazarus trunk. The bindings are being improved.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #6 on: March 21, 2018, 08:08:11 pm »
The lib and source can be found and downloaded on the link I gave.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #7 on: March 21, 2018, 08:08:48 pm »
My Chakra Linux has it in repos, package qt5pas version 2.6.r57057-1  :)
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #8 on: March 22, 2018, 01:16:25 am »
Ok, my information was outdated then.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

OH1KH

  • Jr. Member
  • **
  • Posts: 63
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #9 on: March 22, 2018, 07:31:56 am »
My dear friends!

Ubuntu and Chakra linuxes are NOT Fedora.
So the original question is still unanswered.

I can compile library if just get link to sources but Lazarus wiki(s qt and qt5) or readme.txt under lcl/.... do not state the place.

Easier would be installation from package but it seems not be done for Fedora.
--
Saku

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #10 on: March 22, 2018, 08:12:37 am »
Again, I ask you which wiki page did you read?

See the image below. The wiki page really has the link for downloading the lib and source.

OH1KH

  • Jr. Member
  • **
  • Posts: 63
Re: How to use Qt5 with Lazarus-IDE 1.8? [solved]
« Reply #11 on: March 22, 2018, 10:47:28 am »
HI !

That link leads to site where everything is quite old.

But I think I am able to resolve this. Compile of bindings is now running. Seems to take some time.

Problem is this(quete my first message):
--------
Assume it is because of bindings. Wiki says:
Bindings sources are located in lcl/interfaces/qt5/cbindings , to build it just follow README.txt.

Found them from /usr/lib64/lazarus/lcl/interfaces/qt5/
-----------
Yep found them and there is readme.txt that says download libqt5pas.so

But now I spent more time to study the folder structure and there is another readme.txt under /cbindings.
Actually just what the wiki says!  8)

And that readme has totally different content !!
Why, why, why they cannot be equal! Or at least the higer level readme should say that if you can not find ready made libqt5pas.so dive into subdir cbindings and see readme.txt there.

Now when you navigate to directory structure like this and you get into qt5 and find readme.txt  you assume that is the one that tells all, but nope !!

My fault not to search every subdir, or read a little better the wiki !
But nice to see that no one else could not advise me too dive into subdir cbindings and look a bit more carefully !!

And another addition to cbindings/readme.txt would be that mentioned "qmake" command is "qmake-qt5" when using Fedora releases.

While writing this "make" finished and then I made "make install".
Next step was to open my program in lazatus. QT5 is there selected allready and make buld.
Now it went through without linking error.

Other quesiton is how it works, but that is another subject.

So, for use QT5 with program (in Fedora26 x86_64):
-goto project properties and select LCL widgetset "qt5"
-navigate to /lib64/lazarus/lcl/interfaces/qt5/cbindings/
(note ordinary user does not have write rights there, use sudo in front of commands, or copy directory cbindings (with subdirs) to user's folders. Then you need sudo just for "make install") 
-issue command: qmake-qt5 -query
-issue command: qmake-qt5
-issue command: make    (takes quite long time, just wait...)
-issue command :make install
Go back to Lazarus and issue "biuld".

After that start debugging your previously gtk written program.
Maybe later recompile lazarus to use qt5.
--
Saku

alanphys

  • Jr. Member
  • **
  • Posts: 56
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #12 on: March 22, 2018, 11:19:05 am »
Hi

Sorry I'm only getting to this now. For Fedora you need to install qt5-creator and qt5-devel. This will give you qmake-qt5. For some reason my Fedora had qmake-qt4 installed by default. This will not work. Also do not run qmake-qt5 as su or sudo it will recompile your system qt5 with potentially disastrous results. Apart from this it is a matter of following the readme file in the cbindings folder.

There is a problem exiting programs in the debugger. An exception is generated. We are not sure of the cause as it is difficult to track as the debugger has already shut down at that stage.

Regards
Alanphys
Fedora 34 + KDE/QT5, Tinycore 8, Windows XP-10
https://github.com/alanphys

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #13 on: March 22, 2018, 11:37:49 am »
@OH1KH, @alanphys

If you managed to make it works, please consider to update the wiki page so others can benefit from your experience.

If you found the information in the documentation/wiki is outdated or incorrect, please improve them or at least submit a report to the bug tracker forum:
http://bugs.freepascal.org/view_all_bug_page.php

M+AUDIO

  • New Member
  • *
  • Posts: 48
Re: How to use Qt5 with Lazarus-IDE 1.8?
« Reply #14 on: January 05, 2021, 10:35:54 pm »
I encountered this same problem for compiling a project for x86_64 linux with Qt5 widgetset. From GTK2 Lazarus.
Code: Pascal  [Select][+][-]
  1. Warning: linker: /usr/bin/ld: cannot find -lQt5Pas
  2. bithesabgui.lpr(37,1) Error: Error while linking
And this (old) thread was in google results.


So I just wanted to add that with Fedora 33 and latest Lazarus trunk to this date (r64335) it only took me to install these packages using Terminal
Code: Pascal  [Select][+][-]
  1. sudo dnf install qt5pas qt5pas-devel
+ selecting Qt5 widgetset inside additional and overrides inside project options.
And it just worked! No extra steps.

And since the compiled app requires the library file libQt5Pas.so.1 at runtime, you need to have qt5pas in your destination system (user system) as well. so qt5pas is somehow a required runtime library.
The equivalent in Xubuntu 20.10 is libqt5pas1 (with that 1) as the runtime library and libqt5pas-dev for compilation and linking library.

PS
Glad to see Qt5 is so stable compared to GTK3. Congratulation to the Devs.
« Last Edit: January 05, 2021, 10:42:10 pm by M+AUDIO »

 

TinyPortal © 2005-2018