Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As LCLQt6 widgetset is ready, let's consider it #188

Open
Alexey-T opened this issue Dec 28, 2022 · 6 comments
Open

As LCLQt6 widgetset is ready, let's consider it #188

Alexey-T opened this issue Dec 28, 2022 · 6 comments

Comments

@Alexey-T
Copy link

e.g. here, bgraqtbitmap.pas

uses LCLType,
  LCLIntf, IntfGraphics,
  qtobjects, {$ifdef LCLqt5}qt5{$else}qt4{$endif},
@Alexey-T
Copy link
Author

and here, bgrabitmap.pas

			{$IF defined(LCLqt) or defined(LCLqt5)}

2 lines like this.

@Alexey-T Alexey-T changed the title As LCLQt6 widgetset is ready, let's consider Qt6 As LCLQt6 widgetset is ready, let's consider it Dec 28, 2022
@circular17
Copy link
Contributor

Good to know.

@circular17
Copy link
Contributor

Hi Alexey,

Do you have Qt6 installed to check if only adding the directive for it would function properly?

Regards

@Alexey-T
Copy link
Author

Not adding a directive by hands, but adding the option in the LCL Project options: widgetset name.

@regs01
Copy link

regs01 commented May 19, 2024

I tried testvirtualscreen under Linux with Qt6, but it just won't redraw anything, unless full repaint is ticked on. And with full repaint it's very slow.

@circular17
Copy link
Contributor

circular17 commented May 19, 2024

Thank you @regs01 for testing! Ok, so there may be some possible optimizations and would require some patches.

A first step would be that BGRAQtBitmap would be used. You can see it in bgrabitmap.pas unit. In the uses clause, in Lazarus code editor, units not selected by the directives are written with a semi-transparent color. The directives need to be modified. Up to now LCLqt is for Qt4, LCLqt5 is for Qt5. The new macro is LCLqt6 is for Qt6.

Then, we need to determine how to optimize for Qt. One way is to allocate an in-memory image with Qt and assign the Data pointer to its content. Another way is to use direct drawing functions to draw data directly on a canvas, instead of creating an image handle. This depends on what's available in Qt.

There is a QImage class that seems to provide a direct pixel access. It has a bits function that returns the data pointer. The QImage::Format_RGBA8888 format seems to be the most compatible with BGRABitmap, with only red and blue swapped compared to the default BGRA format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants