Fan Yang:
> I'm working on my project which uses scintilla, recently I made a fix for Qt6, please try the attached patch.
For the includes, <QDesktopWidget> can be removed unconditionally as QDesktopWidget was dropped a while ago. Its also fine to add <QTextCodec>.
QFontMetricsF::horizontalAdvance isn’t available in Qt 4.x so it should be protected with #if and a fallback. Its also unclear if this will produce results that are sufficiently different to QFontMetricsF::width to cause any problems. Surface::Width which calls these is used for less common drawing like annotations and line numbers so a problem may not be so apparent and it may differ between platforms and their underlying text engines.
Replacing viewOptions with initViewItemOption appears less likely to cause problems and is adequately guarded.
Linking to core5compat appears to be needed just for QTextCodec but I couldn’t find a replacement for QTextCodec that would avoid the need for core5compat.
Overall, this doesn’t appear safe enough to include in the upcoming release 5.1.5 but it could be applied after this release with a backup for horizontalAdvance on 4.x.
Neil