Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Notifications
Clear all

Lazarus Pascal - Linux Qt5 - Fix controls not showing under Wayland (QT5)

1 Posts
1 Users
0 Reactions
12 Views
 Hans
(@hans)
Famed Member Admin
Joined: 13 years ago
Posts: 3210
Topic starter   [#1599]

With Lazarus I ran into the issue that controls would not always show when running under Linux (Wayland) using Qt5.

Seems you need to force the Lazarus app to use "xcb" instead of "wayland" (note: I'm far from an expert on this topic!).

This is how I fixed it:

I created a unit which has its initialization started before the widget set is started, and sets the environment variable for QT_QPA_PLATFORM (see also: Qt docs).

 

1) Create a unit to set the environment to use "xcb". 

unit QtPlatformFix;

{$mode objfpc}{$H+}

interface

implementation

{$IFDEF LCLQt5}
function setenv(name, value: PChar; overwrite: Integer): Integer; cdecl; external;
{$ENDIF}

initialization
  {$IFDEF LCLQt5}
  setenv('QT_QPA_PLATFORM', 'xcb', 1);
  {$ENDIF}

end.

 

2. In the project file (LPR) add the unit, so its one of the first things to be executed.

program RenameMyTVSeries;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  
  {$IFDEF LCLQt5}
  QtPlatformFix,  // <---- add this
  {$ENDIF}
  
  Interfaces, ...

 

 

What is xcb?
A C-language library designed to replace the older Xlib library for communicating with the X11 display server on Unix-like and Linux operating systems



   
ReplyQuote
Share: