Created
March 3, 2023 11:03
-
-
Save torarnv/7bbd31d9879c390071d5aa0e9a1f2af1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git i/src/plugins/platforms/cocoa/qcocoawindow.mm w/src/plugins/platforms/cocoa/qcocoawindow.mm | |
index cb813114ef8..be2efdae110 100644 | |
--- i/src/plugins/platforms/cocoa/qcocoawindow.mm | |
+++ w/src/plugins/platforms/cocoa/qcocoawindow.mm | |
@@ -134,16 +134,18 @@ void QCocoaWindow::initialize() | |
if (!m_view) | |
m_view = [[QNSView alloc] initWithCocoaWindow:this]; | |
- // Compute the initial geometry based on the geometry set on the | |
- // QWindow. This geometry has already been reflected to the | |
- // QPlatformWindow in the constructor, so to ensure that the | |
- // resulting setGeometry call does not think the geometry has | |
- // already been applied, we reset the QPlatformWindow's view | |
- // of the geometry first. | |
- auto initialGeometry = QPlatformWindow::initialGeometry(window(), | |
- windowGeometry(), defaultWindowWidth, defaultWindowHeight); | |
- QPlatformWindow::d_ptr->rect = QRect(); | |
- setGeometry(initialGeometry); | |
+ if (!isForeignWindow()) { | |
+ // Compute the initial geometry based on the geometry set on the | |
+ // QWindow. This geometry has already been reflected to the | |
+ // QPlatformWindow in the constructor, so to ensure that the | |
+ // resulting setGeometry call does not think the geometry has | |
+ // already been applied, we reset the QPlatformWindow's view | |
+ // of the geometry first. | |
+ auto initialGeometry = QPlatformWindow::initialGeometry(window(), | |
+ windowGeometry(), defaultWindowWidth, defaultWindowHeight); | |
+ QPlatformWindow::d_ptr->rect = QRect(); | |
+ setGeometry(initialGeometry); | |
+ } | |
recreateWindowIfNeeded(); | |
@@ -1468,7 +1470,7 @@ void QCocoaWindow::recreateWindowIfNeeded() | |
const bool shouldBeContentView = !parentWindow | |
&& !((type & Qt::SubWindow) == Qt::SubWindow) | |
- && !isEmbeddedView; | |
+ && !isEmbeddedView && !isForeignWindow(); | |
if (isContentView() != shouldBeContentView) | |
recreateReason |= ContentViewChanged; | |
@pmogylevskyi are the builtin Apple Audio Units working for you in your app ? I am able to load / view NSView for most third party ones but some of the apples ones crash AUBandPass being the first example.
It is definitely to do with using QWindow::fromWinId() + QWidget::createWindowContainer() if I just do QWindow::fromWinId() and show that window it works fine, as soon as I add QWidget::createWindowContainer() to embed in a widget hierarchy (we need preset selection etc right) it crashes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@torarnv , thanks for your reply. Yes, I'm writing the host which loads plugins, e.g. third-party Audio Units plug-ins (IK MULTIMEDIA, Waves, etc. ), Apple Audio Units plug-ins. I'm get an incoming NSView from those plugins. It worked well in Qt 5.15.x but broken in Qt 6.4.2. I found a solution which based on your changes here. Unfortunately, I don't have the minimal sample application. I will try to write it and open JIRA ticket. Thanks!