Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. macOS: Copy / Paste menu items disabled after opening a native file open dialog
QtWS25 Last Chance

macOS: Copy / Paste menu items disabled after opening a native file open dialog

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mabeghin
    wrote on last edited by
    #1

    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...

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mabeghin
        wrote on last edited by
        #3

        @mpergand said in macOS: Copy / Paste menu items disabled after opening a native file open dialog:

        as well.

        That's my main menu bar Edit / Copy & Paste items that get disabled

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mpergand
          wrote on last edited by
          #4

          Main menu is ok, Select All works also.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mabeghin
            wrote on last edited by
            #5

            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...

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mpergand
              wrote on last edited by
              #6

              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 ?

              1 Reply Last reply
              1
              • M Offline
                M Offline
                mabeghin
                wrote on last edited by
                #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

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mpergand
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mabeghin
                    wrote on last edited by mabeghin
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mpergand
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mabeghin
                        wrote on last edited by
                        #11

                        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

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mpergand
                          wrote on last edited by
                          #12

                          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.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved