Recent

Author Topic: [solved] Qt6 and the Save Dialog  (Read 17418 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3725
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6 and the Save Dialog
« Reply #15 on: February 27, 2023, 02:23:10 am »
Worth noting that Debian Bookwork now has Qt6 6.4.2 and it does NOT exhibit this bug, that looks to me like the world is just about ready for Qt6 apps from Lazarus !

Yet again, thanks zeljko !

Davo

(Bookworm is currently in "soft freeze", easy to get end user apps into but harder for tool chain type things. Some time in March, next level will slow things down even more.)
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 3725
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6 and the Save Dialog
« Reply #16 on: February 27, 2023, 03:36:02 am »

NO, I am sorry, in my excitement, I posted too early !

Further testing reveals that the bug is still there, seems Desktop dependent to some degree in that what goes wrong seems dependent on the DE, but wrong, one way or another, on at least XFCe and Gnome.

Does not seem to relate to Wayland.

 :'(

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #17 on: February 27, 2023, 07:21:01 am »
I just now tried QFileDialog_getSaveFileName directly. Well, calling the binding function directly that is...

I notice some delay, as in it is not instant, but no more delay than any other opening of a dialog box on my system.

Less than half a second for sure, likely well under that.

This is on Linux with XFCE4. (AlmaLinux 9.1 x86_64).

(libqt6pas6-6.2.5-1 and qt6 6.3.1.)

« Last Edit: February 27, 2023, 07:55:05 am by Bogen85 »

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #18 on: February 27, 2023, 07:53:18 am »
I tried QFileDialog_getSaveFileName with qt6 6.4.2 as well (also XFCE4). Delay is insignificant.

(Fedora 37, X86_64)
« Last Edit: February 27, 2023, 07:55:24 am by Bogen85 »

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #19 on: February 27, 2023, 07:58:11 am »
Oh, looks like I would need to call QFileDialog_getOpenFileNames.

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #20 on: February 27, 2023, 09:10:40 am »
Well, I tried both QFileDialog_getSaveFileName and QFileDialog_getOpenFileNames with and without QFileDialogOptionDontUseNativeDialog on both 6.3.1 and 6.4.2 and the delay is insignificant.

QFileDialogOptionDontUseNativeDialog did change the dialog appearance.

dbannon

  • Hero Member
  • *****
  • Posts: 3725
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6 and the Save Dialog
« Reply #21 on: February 27, 2023, 11:18:26 am »
Ok Bogen, have you tried it with LCL

Its just a form, a button, a SaveDialog. In the button's default action, put -

Code: Pascal  [Select][+][-]
  1. if SaveDialog1.Execute then
  2. writeln(SaveDialog.filename);

Or something similar ....

Edit : finished premature terminated text ...
« Last Edit: February 27, 2023, 11:20:19 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 3725
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6 and the Save Dialog
« Reply #22 on: February 27, 2023, 12:07:36 pm »
Hmm, so I tried calling QFileDialog_getSaveFileName directly, as Bogen85 does, same thing. I see an initial frame for the dialog appear, but it fails to paint. Does not seem to time out ....

This is on Debian Bookworm (ie Testing) XFCe, Qt6 6.4.2 and using the LibQt6Pas libraries from https://github.com/davidbannon/libqt6pas

Now, these libraries were built from Qt6.2.1 (from memory), maybe thats the problem ?

Bogen, are you using libqt6pas built locally ?

(I am running out of diskspace on the drive where I keep my VMs and don't want to install Alma linux because I am in the middle of releasing my own app right now)

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1873
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Qt6 and the Save Dialog
« Reply #23 on: February 27, 2023, 01:13:07 pm »
Seem that it's not fixed in Qt git repo. Issues about open/save file dialog are still open.

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #24 on: February 27, 2023, 05:02:42 pm »
Hmm, so I tried calling QFileDialog_getSaveFileName directly, as Bogen85 does, same thing. I see an initial frame for the dialog appear, but it fails to paint.

Mine paints right away.

Does not seem to time out ....

Yeah, does not time out for me. Well, paints right away (so a time out is not applicable), acts like a normal dialog. For both I check the returned value (or values) and they are what I selected.

This is on Debian Bookworm (ie Testing) XFCe, Qt6 6.4.2 and using the LibQt6Pas libraries from https://github.com/davidbannon/libqt6pas
Now, these libraries were built from Qt6.2.1 (from memory), maybe thats the problem ?
Bogen, are you using libqt6pas built locally ?

On both Fedora 37 (Qt 6.4.2) and AlmaLinux 7.1 (Qt 6.3.1) I'm building and installing the libqt6pas packages on the respective machines. (local build and install).

I'll try with your package.

EDIT: 6.3.1, not 6.2.1
« Last Edit: February 28, 2023, 06:45:34 am by Bogen85 »

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #25 on: February 27, 2023, 05:05:50 pm »
Ok Bogen, have you tried it with LCL

Its just a form, a button, a SaveDialog. In the button's default action, put -

Code: Pascal  [Select][+][-]
  1. if SaveDialog1.Execute then
  2. writeln(SaveDialog.filename);

Or something similar ....

I'll try that. I've not been using LCL visual components.

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #26 on: February 27, 2023, 05:18:53 pm »
Ok Bogen, have you tried it with LCL

Its just a form, a button, a SaveDialog. In the button's default action, put -

Code: Pascal  [Select][+][-]
  1. if SaveDialog1.Execute then
  2. writeln(SaveDialog.filename);

Or something similar ....

I'll try that. I've not been using LCL visual components.

Or could try that... Not sure what a standalone FPC example for that would look like...

But if @dbannon is seeing this problem with libqt6pas directly (and I'm not with locally built packages) I guess I would not need to.

rca

  • Full Member
  • ***
  • Posts: 121
Re: Qt6 and the Save Dialog
« Reply #27 on: February 27, 2023, 06:17:29 pm »
I have Fedora 37 Worksation with Gnome.

I installed lazarus and fpc trunk with fpcupdeluxe

Locally compile libqt6pas.

I open @dbannon's Qt6SaveAs example, and it doesn't work to open the Save Dialog.

But to my surprise, with Lazarus IDE, inside "Object Inspector",
When trying to open the Color or Font dialogs, they don't open either.

All the IDE dialogs are fixed and work, including the example, when installing "qt6ct", it is with
"Style: Fusion", "Palette:Default" and "Standard dialogs:Default"

Without installing qt6ct, inside the .config/QTProject.conf file it shows:
Code: Pascal  [Select][+][-]
  1. [FileDialog]
  2. history=@Invalid()
  3. lastVisited=file:///home/mfedo/Test/Laza/Qt6SaveAs
  4. qtVersion=6.4.2
  5. viewMode=Detail


When installing qt6ct, it works and the .config/QTProject.conf file shows:
Code: Pascal  [Select][+][-]
  1. [FileDialog]
  2. history=file:///home/mfedo/Test/Laza/Qt6SaveAs
  3. lastVisited=file:.
  4. qtVersion=6.4.2
  5. shortcuts=file:, file:///home/mfedo
  6. sidebarWidth=106
  7. treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x2l\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\x1G\0\0\0\x1\0\0\0\0\0\0\0L\0\0\0\x1\0\0\0\0\0\0\0Q\0\0\0\x1\0\0\0\0\0\0\0\x88\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff\0\0\0\0)
  8. viewMode=Detail

Bogen85

  • Hero Member
  • *****
  • Posts: 703
Re: Qt6 and the Save Dialog
« Reply #28 on: February 27, 2023, 07:36:42 pm »
On both Fedora 37 (Qt 6.4.2) and AlmaLinux 7.1 (Qt 6.3.1) I'm building and installing the libqt6pas packages on the respective machines. (local build and install).

I'll try with your package.

On both Fedora and AlmaLinux I replaced the locally built packages with the ones from https://github.com/davidbannon/libqt6pas/releases

Rebuilt my dialog examples.
For both dialogs, the delays are insignificant, so they are completely usable.

As far as LCL, I looked at https://wiki.freepascal.org/Using_the_LCL_without_Lazarus but that looks far more involved than just using libqt6pas.

EDIT: 6.3.1, not 6.2.1
« Last Edit: February 28, 2023, 06:46:04 am by Bogen85 »

dbannon

  • Hero Member
  • *****
  • Posts: 3725
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Qt6 and the Save Dialog
« Reply #29 on: February 27, 2023, 11:59:34 pm »
.....
I open @dbannon's Qt6SaveAs example, and it doesn't work to open the Save Dialog.
....
All the IDE dialogs are fixed and work, including the example, when installing "qt6ct", it is with
"Style: Fusion", "Palette:Default" and "Standard dialogs:Default"
....
Well, rca, you are on to something here. I tried a couple of the known problem systems and sure enough, it all works fine if qt6ct is in control !  Its does not work if you have just installed qt6ct without setting an appropriate env var to tell the app to use qt6ct. It does not work if you set the theme to gtk2 or gtk3 either so its not the setting itself that fixes the problem. But involve qt6ct and its good.  eg

Code: Pascal  [Select][+][-]
  1. QT_QPA_PLATFORMTHEME=qt6ct  ./TestQt6  <enter>

Bogen85, do you have a Qt platform theme set to use qt6ct ?  That might explain why it works for you....

Overall, I don't think its a solution to add qt6ct as a dependency and requiring its use. That will interfere with other apps the end user might be using, and, really, is a bit hacky....

I will try building the libs on Bookworm ....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018