macOS: Copy / Paste menu items disabled after opening a native file open dialog
-
Hi everyone,
The issue is with Qt 5.8 (I can't move to higher version because we have to support macOS 10.9)
After I open a native file open dialog, copy & paste menu items are disabled. I inspected the code and couldn't find how to solve it, even by removing & putting back menu items (in this case, shurtcuts are no more working)
It's related to those changes: https://bugreports.qt.io/browse/QTBUG-17291
Does anyone knows how I can solve this issue ? I already compile qt, so changes in qcocoamenu is a possibility. But the code is complex there and putting breakpoints I couldn't find where we're doing things that makes this menu item disabled event after closing file dialog... -
HI,
The issue is with Qt 5.8 (I can't move to higher version because we have to support macOS 10.9)
Welcome to the club.
After I open a native file open dialog, copy & paste menu items are disabled.
I can't reproduce this.
I can copy/paste from the search field, local menu and shortcuts work as well. -
Are you using Qt 5.8.1 ? If I build with Qt 5.5.1 or Qt 5.11 everything is ok. So there's an issue in my Qt build... I'm now trying to merge changes done to qcocoamenu files into my branch and see which commit fixes the issue, I'm afraid to spend too much time on this... Any assistance from someone who knows cocoa menu implementation would help...
-
Qt 5.8.1 doesn't exist as far as i know.
Qt 5.8 has big menu issues :
https://forum.qt.io/topic/79992/qt-5-8-main-menu-items-disabled-in-osx
It seems unrelated with your problem anyway.
Does it works with Qt 5.7 ? -
Sure, it's Qt 5.8. I just merged some changes from Qt 5.9 to solve a few bugs. I'm stucked because many users still like 10.9.5 for its stability (they do live performances with our app and they don't like changing a system when they're 100% confident in it). I'll test with Qt 5.7
-
I'm stuck with Qt 5.8 for the same reason as you.
But i don't understand the problem your facing with the native dialog on Qt 5.8, because i can't reproduce it. (my computer is on osx 10.9.5)
I suggest you to have a test with a minimal app, a single window that open the dialog, and see what happens. -
I can reproduce the issue with official 5.8 and a minimal example. I made a zip with all files here (4kb): https://www.dropbox.com/s/stsy3ax97wtg6bv/testmenus.zip?dl=0
Copy & Paste get disabled after using QFileDialog::getOpenFileName, even if I set no shortcut at all. Just naming items "Copy" and "Paste" is enough to get the issue. Menu item TEST doesn't get disabled... If I put Copy and Paste in menu TOTO (instead of Edit), the issue is also happenning. -
Ok got it.
The copy and paste are disabled after the open dialog is closed. (i didn't understand that sorry)
Select All is disabled too.
Only the shorcuts operate.A test with Qt 7.1 the menu looks ok.
To say the truth, Qt 5.8 is buggy as hell and pretty unusable on mac, (the native color panel has no buttons !)
For me the last reliable Qt version is Qt 5.7 (or Qt 5.6) for mac with Mavericks.
-
The problem is that I need Web Engine and we got things working properly with Qt 5.8 but not with previous builds. Anyway, I found a workaround, I name my menu item "Copy " (with a space after) and it's no more disabled... That's bad but anyway, until we get rid of 10.9... Thx
-
Looking at what happens to the NSMenuItem for Paste, i see that qt set the target to QCocoaMenuDelegate and the selector to itemFired:
After the Open dialog is closed, the target is null and the selector paste:
I tryed to reset this fields to their initiate values but to no avail.The only work around I see is to recreate the window menubar.