Unsolved Mac Menus are not active ????
-
Then, please, provide us the means to reproduce that situation.
We are already several people not getting that problem. Therefore without your code we cannot help to either find the bug that you might have uncovered in Qt or find the one that you have in your application.
-
I'm trying to put something together. It seems like if I have a .ui file for the mainwindow and use the ui-> things seem to work, if I don't then that's when the problems seem to appear. I'm trying to make a small example.
-
I have tried to reproduce this problem with smaller subsets of code and cannot. I not really sure how to debug this problem.
I've rebuilt the project from scratch adding items and testings as I went along. Everything worked fine up the the point of adding a resource file .
Currently I have only the default Mac menu item, everything else is on the toolbar and working. All the application works except for the menu being dead until clicking on another program and then back.
-
@Nevering
If you have a sample that can be built and tested,
please upload to git or any other site where
its easy for people to get it as one zip/together easy to run project.That way its very likely that others will try your test program and we can find out if
its just on your system or its actually a Qt bug :) -
I was able to reproduce this in a small test project. I don't see a way of uploading a zip file
-
Once your menubar is created, add those 2 lines:
// Qt5.6: this seems to force the previous menubar to show up and activate auto m = new QMenuBar; m->deleteLater();
This create another parentless top-level menubar and delete it later. I've been debugging through Qt's macOS menu handling code and it seems to have changed a lot between Qt5.5 and Qt5.6. This code triggers the native menu bar synchronisation that used to happen automatically. Looks like they screw this up for 5.6.
-
Thanks for the answer, but that didn't help.. Still got a hang
-
added it like this
ui->setupUi(this); QPixmap pix(":/images/user.png"); QIcon ico(pix); ui->toolButton->setIcon(ico); auto m = new QMenuBar; m->deleteLater();
I'll try again after the ui->setup
-
Same thing
-
@Nevering
A test project would be great. -
I think I've added the code here ??
https://github.com/Nevering/Splitters.git -
@Nevering
"This repository is empty." -
There now, please try again
learning github -
@Nevering
Well, it's pretty simple in your case, don't do:CONFIG -= app_bundle
-
why ?
If I don't the files in the subdirectories are not found
-
Well not found in my actual application. that has sever folders were files are being used for building aspects of the application.
-
@Nevering said in Mac Menus are not active ????:
why ?
Gui applications on Mac are bundles.
If I don't the files in the subdirectories are not found
Look at how to embed resources, either the Qt way, with the 'Qt Resource Compiler' or the Mac's way with bundle resources.
If you really want to keep those as external files you'll need to adjust the relative path on Mac.
-
is this a good reference, or is there a better one, this is from 4.8.
-
I ran a test and saw exactly what you described in this thread (Qt 5.6.0, OSX 10.10.5, XCode 7.2.1). I tried changing a few things here and there in the source to see if I could get it to work without success. Changes in the PRO file seemed to affect it.
In the project file I remove this line:
CONFIG -= app_bundle
and replaced it with this:
CONFIG +=release \ warn_on \ qt \ thread
It worked fine after this change for some reason.
I didn't look into what the differences are in these options of the project file. These are common options I use for everything. Maybe try this and see if this works for you as well.
I also tried converting the UI file into a set of cpp files (generic main.cpp, mainwindow.cpp, and mainwindow.h). It worked regardless of the above change in the PRO file.
It looks like there is something odd going on but I am not sure what the source is. The project file supplied with this sample should be cleaned up regardless (maybe this is the underlying reason?). The project file from the CPP generated version is a little more complete so this could be a reason I didn't see this problem with the derived version and only with the UI version (?).
-
Someone please help me understand the problem. Why did CONFIG -= app_bundle cause the problem and removing fix it? The article linked above says that CONFIG -= app_bundle should be used for Macs .