Skip to content

Support qt6#2297

Merged
jdtournier merged 15 commits intodevfrom
dev_qt6
Dec 19, 2022
Merged

Support qt6#2297
jdtournier merged 15 commits intodevfrom
dev_qt6

Conversation

@bjeurissen
Copy link
Copy Markdown
Member

Support qt6

@bjeurissen bjeurissen mentioned this pull request Mar 9, 2021
@maxpietsch
Copy link
Copy Markdown
Member

In Qt >= 5.13, one can override the OS default settings for the display of keyboard shortcuts: https://doc.qt.io/qt-5/qstylehints.html#showShortcutsInContextMenus-prop

0e837d9 sets this to true:
image

@maxpietsch maxpietsch added this to the 3.1.0 updates milestone Jun 25, 2021
@bjeurissen
Copy link
Copy Markdown
Member Author

bjeurissen commented Jul 7, 2021

I noticed this issue, which makes it unfit to merge:

qt6.mp4

It is unrelated to the removal of expandedTo.

Can you reproduce this @maxpietsch ?

@maxpietsch
Copy link
Copy Markdown
Member

maxpietsch commented Jul 7, 2021

What QT version are you using? I can't even configure it with homebrew's latest qt (6.1.1) due to a missing link to the moc executable which is located not in the bin folder in 6.1.1:

➜  brew unlink qt; brew link qt5
➜ ls /usr/local/bin/moc
lrwxr-xr-x  1 mp  admin    29B  7 Jul 12:40 /usr/local/bin/moc -> ../Cellar/qt@5/5.15.2/bin/moc
➜  brew unlink qt5; brew link qt
➜ ls /usr/local/bin/moc
ls: /usr/local/bin/moc: No such file or directory
/usr/local/Cellar/qt@5/5.15.2/bin/moc # exists
/usr/local/Cellar/qt/6.0.2/bin/moc # exists
/usr/local/Cellar/qt/6.1.1/bin/moc # does not exist
/usr/local/Cellar/qt/6.1.1/share/qt/libexec/moc # exists

Edit:

I get the same issue with PATH=/usr/local/Cellar/qt/6.1.1/share/qt/libexec/:/usr/local/Cellar/qt/6.1.1/bin:$PATH ./configure or the 6.0.2 equivalent and a few more deprecation warnings.

@maxpietsch
Copy link
Copy Markdown
Member

mrview_qt6.mp4

@jdtournier
Copy link
Copy Markdown
Member

Weird... What happens when you resize if the dock widget is blank?

@maxpietsch
Copy link
Copy Markdown
Member

maxpietsch commented Jul 7, 2021

A horizontal resize does not change the behaviour. However, if one undocks the widgets after the first successful open as a docked tool, all works including closing and reopening them.

@jdtournier
Copy link
Copy Markdown
Member

OK. We may have to revisit the size handling for dock widgets...

@bjeurissen
Copy link
Copy Markdown
Member Author

What QT version are you using? I can't even configure it with homebrew's latest qt (6.1.1) due to a missing link to the moc executable which is located not in the bin folder in 6.1.1:

I used 6.1.1 as follows:

PATH=$(qmake -query QT_HOST_LIBEXECS):$PATH ./configure && ./build bin/mrview

@bjeurissen
Copy link
Copy Markdown
Member Author

what about this output:

QPainter::begin: paint device returned engine == 0, type: 2
QPainter::translate: Painter not active
QPainter::rotate: Painter not active

?

@jdtournier
Copy link
Copy Markdown
Member

Issues confirmed on Linux with Qt6 (6.1.2). I'll have a quick look into it...

@jdtournier
Copy link
Copy Markdown
Member

OK, I think the empty tool issue is a bug in Qt6 when using vertically-arranged tabs for the dock widgets. @bjeurissen, @maxpietsch: give this last commit a go, see if it fixes the issue for you (does for me on Linux).

Screenshot from 2021-07-09 14-13-59

@maxpietsch
Copy link
Copy Markdown
Member

maxpietsch commented Jul 23, 2021

Horizontal tabs work on macOS, Qt 6.1.1. However, a few issues I noticed:

  • if the connectome tool is opened, the node list is always displayed at the bottom also for other tools
  • vertical scrolling of tools seems deactivated, instead, the main window size is enlarged to accommodate the tool. The window height can be reduced somewhat but not beyond the size of the largest opened tool. This is an issue for the connectome tool, in particular.
  • other than the connectome tool node list, no tool window can be undocked tools can be undocked by dragging their title, not the tab GUI element above it. This is counter intuitive as dragging the tab element in macOS finder open the tab in a new window.
  • opening the view options tool the first time prints the below text to the terminal (this is not the case for the other tools):
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::translate: Painter not active
QPainter::rotate: Painter not active

image
image

These clash with custom memory allocators in Qt6, and haven't been
required in our builds for a long time since we no longer compile with
-march=native by default.

Besides, there's a good chance that these memory alignment issues are no
longer relevant for Eigen 3.4 - would require testing...
@jdtournier
Copy link
Copy Markdown
Member

OK, I've had a quick go at looking into Qt6 support for the latest dev, and I got it to work on my Arch Linux desktop against Qt 6.4.1 (latest on Arch). It seems to work OK, though I've not done any thorough testing of the issues previously mentioned here (I'd totally forgotten about them, to be honest...).

It did require one major change though: the last commit removes all checks and balances for AVX512 support (which requires 32 byte alignment rather than the default 16). I've been thinking about doing this for a while since we don't compile with AVX512 support by default, and haven't for a long time. My own testing showed a relatively minor difference in performance, and you'll find lots of criticism of AVX512 online (basically it's very power-hungry and often causes performance regressions due to heating-induced CPU throttling).

Removing all this code has the distinct advantage of simplifying the code base somewhat, and not having to explain why our code is peppered with these MEMALIGN macros is a bit of a relief... Moreover, there's a good chance that using C++17 is sufficient to completely avoid these issues, so if anyone is absolutely hell-bent on using AVX512, they should be able to do so simply by using CXXSTD=c++17 ./configure.

So I don't think it's a great loss... I hope everyone is OK with that?

@Lestropie
Copy link
Copy Markdown
Member

Inconsequential correction: Eigen report that AVX512 may require 64-byte alignment:

For instance, SSE/NEON/MSA/Altivec/VSX targets will require 16-byte-alignment, whereas AVX and AVX512 targets may require up to 32 and 64 byte alignment respectively.

If you've done the testing and not seen a worthwhile improvement in performance with AVX512, I've no issue with removing it; it'll already be absent from the pre-compiled binaries. More generally, I've not delved into the allocation alignment topic as much as you have, so I'll trust your judgement.

@Lestropie
Copy link
Copy Markdown
Member

Also, I think FFTW might use AVX512; might want to double-check that mrfilter fft is happy?

@bjeurissen
Copy link
Copy Markdown
Member Author

OK, I've had a quick go at looking into Qt6 support for the latest dev, and I got it to work on my Arch Linux desktop against Qt 6.4.1 (latest on Arch). It seems to work OK, though I've not done any thorough testing of the issues previously mentioned here (I'd totally forgotten about them, to be honest...).

Works on macOS Monterey without any of the previous issues!

configure: fix Qt parameter parsing for MacOS
@jdtournier
Copy link
Copy Markdown
Member

Inconsequential correction: Eigen report that AVX512 may require 64-byte alignment:

Ouch. I'm pretty sure we never targeted such large alignment requirements... In fact, looking back at the code, we only ever aligned at 16 bytes... I think we would already have been in trouble with AVX / AVX512 if anyone had ever tried to compile with these instructions...

Also, I think FFTW might use AVX512; might want to double-check that mrfilter fft is happy?

Good point. Though if that's the case, it would have been an issue already: we link against the pre-compiled library, so we have no control over whether it decides to use these instructions. I'm assuming that the FFTW libraries will only use these instructions if it's detected it's running on hardware that supports them, and if it does that, it'll already have done all its required checks and balances.

But you're right, there's a chance that if we pass a structure that doesn't have the expected alignment, when it would have had the expected alignment with the previous MEMALIGN macros in place, then that might cause issues. I note there are no tests in the CI for the FFT filter, most likely because it's currently pretty buggy on master - this was overhauled for #2338, though on the basis of this discussion, it may be worth adding some tests...

@bjeurissen
Copy link
Copy Markdown
Member Author

640443c will hopefully make this play with qt<5.14 and consequently fix the failing CI on linux and windows.

@bjeurissen
Copy link
Copy Markdown
Member Author

bjeurissen commented Nov 23, 2022

Screenshot 2022-11-23 at 11 09 18

Qt6 seems to provide a better native HiDPI experience on macOS.

The above is a screenshot at 4k resolution of both Qt5(top) and Qt6 mrview (bottom).

@jdtournier jdtournier enabled auto-merge December 19, 2022 16:35
@jdtournier jdtournier merged commit 3f4e266 into dev Dec 19, 2022
@jdtournier jdtournier deleted the dev_qt6 branch December 19, 2022 17:19
@Lestropie Lestropie mentioned this pull request Feb 9, 2023
6 tasks
@Lestropie Lestropie added the gui label Mar 28, 2023
Lestropie added a commit that referenced this pull request Jan 23, 2024
Merge commit 2c6c831 had remaining within it a vestigial MEMALIGN macro, removed on the "dev" branch in #2297.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants