Author Topic: Qt6 Development  (Read 210758 times)

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Qt6
« Reply #525 on: January 24, 2023, 01:21:55 am »
Code: [Select]
[W:\]yum provides avutil56.dll
ffmpeg-libs-4.2.2-4.oc00.i686 : Libraries for ffmpeg
Repo        : netlabs-rel
Matched from:
Other       : avutil56.dll



ffmpeg-libs-4.2.2-4.oc00.pentium4 : Libraries for ffmpeg
Repo        : netlabs-rel
Matched from:
Other       : avutil56.dll



ffmpeg-libs-4.2.2-4.oc00.i686 : Libraries for ffmpeg
Repo        : installed
Matched from:
Other       : avutil56.dll

Doug Clark

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +7/-1
    • View Profile
Re: Qt6
« Reply #526 on: January 24, 2023, 05:05:42 pm »
Thanks Dave.

The ffmpeg library, plus libkai, pcre2-utf16 and nss libraries got dooble to at least start.

It won't load any web pages and the menus do strange things (submenus appear in random locations), but I will go back through previous posts and make sure I have all my settings correct.

Thanks again.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6
« Reply #527 on: January 24, 2023, 11:09:19 pm »
Doug, looks through the last few pages and there's a block list to import into Dooble that seems to help with the pages not loading. For menus out of position, look for the link to a qt6core fix.

@Martin - I'm wondering if we need a new thread 'Testing Qt6' with a 'sticky' first post that has the latest links/tips for testing Qt6?  This thread (in the programming section) could then be for anyone suggesting fixes, wanting to build, etc.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Qt6
« Reply #528 on: January 24, 2023, 11:12:07 pm »
@Martin - I'm wondering if we need a new thread 'Testing Qt6' with a 'sticky' first post that has the latest links/tips for testing Qt6?  This thread (in the programming section) could then be for anyone suggesting fixes, wanting to build, etc.

Hi Paul. I agree with you.  I created a new thread called "Qt6 Application Testing".

Regards
« Last Edit: January 24, 2023, 11:19:55 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6
« Reply #529 on: January 25, 2023, 03:21:41 am »
@Martin - I'm wondering if we need a new thread 'Testing Qt6' with a 'sticky' first post that has the latest links/tips for testing Qt6?  This thread (in the programming section) could then be for anyone suggesting fixes, wanting to build, etc.

Hi Paul. I agree with you.  I created a new thread called "Qt6 Application Testing".

Thanks Martin - can I ask that you edit the 1st post as required to include latest builds?

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Qt6
« Reply #530 on: January 26, 2023, 02:16:01 am »
@Martin - I'm wondering if we need a new thread 'Testing Qt6' with a 'sticky' first post that has the latest links/tips for testing Qt6?  This thread (in the programming section) could then be for anyone suggesting fixes, wanting to build, etc.

Hi Paul. I agree with you.  I created a new thread called "Qt6 Application Testing".

Thanks Martin - can I ask that you edit the 1st post as required to include latest builds?

Sure, let me know the links and I will change it.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6 Development
« Reply #531 on: January 26, 2023, 09:52:34 pm »
Hopefully a full rebuild coming today.... I think I've corrected all the duplicate DLL names in QtDeclarative. Ninja makefiles are pretty simple,  so I've developed a patch for the auto-generated file to avoid the name clashes.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6 Development
« Reply #532 on: January 27, 2023, 07:12:32 am »
Find some missing patches today - some source files moved paths, so my diffs didn't apply - and I didn't notice they'd moved :( I did a grep of the code for Q_OS_DOSLIKE - and found some stuff that fixes the gui drive letter issues...

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6 Development
« Reply #533 on: January 29, 2023, 10:18:17 am »
See the testing thread, but there's a new qt6 package at https://www.dropbox.com/s/qax8lg7txx04s81/qt6-6.2.4-os2-20230129.zip?dl=0

- already had highmem run on the main DLLs (ie \qt6\lib & \qt6\plugins)
- All modules now built with ninja
- I've tried to eliminate the DLL name clashes that existed in qtdeclarative
- single package that includes all updates up to 29JAN23
- I also just discovered that qtwebengine has a build\tests folder - so I plan to explore those.

For eg - tst_certificateerrors:
Code: [Select]
********* Start testing of tst_CertificateError *********
Config: Using QtTest library 6.2.4, Qt 6.2.4 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)), os2 Warp 4.5
PASS   : tst_CertificateError::initTestCase()
FAIL!  : tst_CertificateError::handleError(Reject) '(page.error)' returned FALSE. ()
   Loc: [../tests/auto/core/certificateerror/tst_certificateerror.cpp(112)]
[2737:14:0129/202319.184000:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
FAIL!  : tst_CertificateError::handleError(DeferReject) '(page.error)' returned FALSE. ()
   Loc: [../tests/auto/core/certificateerror/tst_certificateerror.cpp(112)]
[2737:14:0129/202334.728000:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -100
[2737:14:0129/202339.066000:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -202
QWARN  : tst_CertificateError::handleError(DeferAccept) ! Socket Error: QAbstractSocket::SocketError(13)
QWARN  : tst_CertificateError::handleError(DeferAccept) HttpServer:   unexpected disconnect
QWARN  : tst_CertificateError::handleError(DeferAccept) ! Socket Error: QAbstractSocket::RemoteHostClosedError
QWARN  : tst_CertificateError::handleError(DeferAccept) HttpServer:   unexpected disconnect
QINFO  : tst_CertificateError::handleError(DeferAccept) HttpServer: GET / 200 30
PASS   : tst_CertificateError::handleError(DeferAccept)
[2737:5:0129/202354.114000:ERROR:cert_verify_proc_builtin.cc(637)] CertVerifyProcBuiltin for revoked.badssl.com failed:
----- Certificate i=0 (CN=revoked.badssl.com) -----
ERROR: Time is after notAfter


[2737:14:0129/202354.162000:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -201
FAIL!  : tst_CertificateError::fatalError() '!page.error->isOverridable()' returned FALSE. ()
   Loc: [../tests/auto/core/certificateerror/tst_certificateerror.cpp(151)]
PASS   : tst_CertificateError::cleanupTestCase()
Totals: 3 passed, 3 failed, 0 skipped, 0 blacklisted, 57733ms
********* Finished testing of tst_CertificateError *********
[2737:14:0129/202354.235000:ERROR:ssl_client_socket_impl.cc(947)] handshake failed; returned -1, SSL error code 1, net_error -201

I also really need to resolve issues with QProcess.... that would probably be enough to allow QtCreator to work...

One PITA with the webengine is not only the time to rebuild the chromium code (every now and then it decides to rebuild 10,000 objects) but just linking qt6webee.dll takes ~ 15 minutes
« Last Edit: January 29, 2023, 10:58:43 am by Paul Smedley »

Alex Taylor

  • Sr. Member
  • ****
  • Posts: 387
  • Karma: +5/-0
    • View Profile
Re: Qt6
« Reply #534 on: January 29, 2023, 07:02:11 pm »
Hey guys,

From the screenshots, it definitely looks like Qt6 is trying to draw the fonts at 96dpi, when they should be 120dpi.

Interesting - so it looks like the dpi setting is also used to scale fonts, as well as screen resolution. I'll dig into this some more - I still think this is a step forward - I'd rather small fonts/menus in the correct location, than larger fonts that are offset in position :)

Cheers,

Paul.

Edit: https://forum.qt.io/topic/125521/how-to-understand-logical-dpi-and-physical-dpi-in-qscreen/4 probably explains what's happening....


It sounds like you've figured out the conversion for window scaling, it's just font scaling that's off.

This stuff can be a bit hard to keep straight, even for someone like me who's studied it at length... I'll include some background info here because it makes it easier for me to articulate things.  It doesn't mean I assume you don't know much of this already.

A font's point size is a fixed unit of measure where 1 pt == 1/72 of an inch.  So when a font is 12pt, that means its "em height" (a measure which means the bounding height of unaccented characters) is 12 points (or 1/8 inch) high.

On a computers, we measure things in pixels instead of inches.  So font scaling is all about figuring out the conversion factor of points to pixels.  To do this, we use the DPI resolution of the output device (the screen or printer). 

OS/2 Presentation Manager supports two DPI settings: 96 (which is the default at 800x600 and below), and 120 (which is the default at 1024x768 and up). 

So when a font is rendered on screen, its em height is scaled down to a number of pixels equal to pts * (DPI / 72). For example, a 12-point font on a 120 DPI screen would be drawn at 12 * 1.666666 == 20 pixels high.

Conversely, if you have a specific pixel height and you want to know the correct point size that will fit it, you flip the equation: points = pixels / (DPI / 72).  So to render an unaccented character (without padding) in a 30-pixel high box at 120 DPI, you need 30 / 1.666666 == 18pt.  (To allow space for accents and line spacing, you'd normally pad this a bit, probably by querying some of the font-specific metrics like lMaxAscender.)

Things get a bit more complicated because some programs like the Mozilla apps (and probably also Qt), define their own DPI setting separately from what PM thinks it should be. 

I assume you need to adjust Qt's DPI to match the current PM value, or else apply a conversion factor between the two.  (I'm not sure how Qt represents this internally.  The documentation I found is not very informative.)

You can query the current PM DPI setting using DevQueryCaps. 

Code: [Select]
HDC hdc
LONG lCap, lDPI = 0;

hdc = WinOpenWindowDC( hwnd )
if ( DevQueryCaps( hdc, CAPS_VERTICAL_FONT_RES, 1, &lCap ))
    lDPI = lCap;
if ( !lDPI )
    lDPI = 120;

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6 Development
« Reply #535 on: January 29, 2023, 09:33:22 pm »
Hi Alex - this is all very helpful, and confirms that my current 'fix' is indeed a workaround. Qt already uses DevQueryCaps (https://github.com/psmedley/qt6-base-os2/blob/main/src/plugins/platforms/os2/qos2screen.cpp#L69), but seems something changed between Qt5 and Qt6 in that that DPI value is now also used for screen scaling, which was causing the menus to be out of position.

So at some point, I need to find the window scaling code, and put in place a better fix for OS/2 so that we don't scale the window, but we do scale the fonts!

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6 Development
« Reply #536 on: January 30, 2023, 08:45:36 am »
Font scaling should be fixed with https://github.com/psmedley/qt6-base-os2/commit/e54d5f1f160f9d5798f2e483ea8f8e7e9014df77 - new qos2.dll link is in the testing thread.

I got lucky with browsing github during my lunch break today, and found https://github.com/psmedley/qt6-base-os2/blob/main/src/gui/kernel/qhighdpiscaling.cpp - searching for references to this led me to a commit which added logicalBaseDPI on other platforms - and voila ;) seems logicalBaseDPI defaulted to 96,96 is not set - which was different to the screen/font dpi of 120,120 - so windows got scaled (which we didn't wnat/need).

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Qt6 Development
« Reply #537 on: January 30, 2023, 12:48:03 pm »
Font scaling should be fixed with https://github.com/psmedley/qt6-base-os2/commit/e54d5f1f160f9d5798f2e483ea8f8e7e9014df77 - new qos2.dll link is in the testing thread.

I got lucky with browsing github during my lunch break today, and found https://github.com/psmedley/qt6-base-os2/blob/main/src/gui/kernel/qhighdpiscaling.cpp - searching for references to this led me to a commit which added logicalBaseDPI on other platforms - and voila ;) seems logicalBaseDPI defaulted to 96,96 is not set - which was different to the screen/font dpi of 120,120 - so windows got scaled (which we didn't wnat/need).

I don't get your explanation. From what I can see, QPlatformScreen::logicalDpi is not properly implemented in your github repo. It just returns QPlatfromScreen::logicalBaseDpi and therefore a 1:1 scaling between "logical" and "physical" for x and also y coordinates.
The BWW repo has an implementation for QPlatformScreen::logicalDpi that is more complex and will lead to a different scaling, at least under certain conditions.
Additionally: Looks like you can fumble around with environment var: QT_FONT_DPI to set your logical DPI. Maybe you can try "set QT_FONT_DPI=120" and see if that makes a difference. At least you can experiment with it ...

And I think it seconds what Alex said: QScreen:: is about Windows scaling and QPlatformScreen:: seems to center around font scaling, at least according to the comments in file qplatformscreen.cpp, at least the BWW repo has this:

Code: [Select]
/*!
    Reimplement this function in subclass to return the logical horizontal
    and vertical dots per inch metrics of the screen.
    The logical dots per inch metrics are used by QFont to convert point sizes
    to pixel sizes.
    The default implementation uses the screen pixel size and physical size to
    compute the metrics.
    \sa physicalSize
*/
QDpi QPlatformScreen::logicalDpi() const
{
    QSizeF ps = physicalSize();
    QSize s = geometry().size();

    if (qFuzzyIsNull(ps.width()) || qFuzzyIsNull(ps.height()))
        return QDpi(96, 96);
    return QDpi(25.4 * s.width() / ps.width(),
                25.4 * s.height() / ps.height());
}
« Last Edit: January 30, 2023, 01:22:50 pm by Lars »

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: Qt6 Development
« Reply #538 on: January 30, 2023, 08:53:19 pm »
This commit is what have me the idea... https://codereview.qt-project.org/c/qt/qtbase/+/157174/

This bug report also pretty much reflects what we were seeing  https://bugreports.qt.io/plugins/servlet/mobile#issue/QTBUG-87035

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Qt6 Development
« Reply #539 on: January 31, 2023, 07:18:21 am »
But does the change go against QScreen or against QPlatformscreen?
I have to admit that I got lost. They are inventing 2 different functions "logicalBaseDPI" and "logicalDPI" that return the exact same value (and sorry, yes, that seemingly changed from QT5 to QT6) and then they introduce them in two different classes. It's also unclear what is now physical and what is virtual. How could you compute a physical DPI value without the ability to query the screen size as physical horizontal and vertical lengths?