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. Qt app on mac
Forum Updated to NodeBB v4.3 + New Features

Qt app on mac

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 1.3k Views 2 Watching
  • 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.
  • SGaistS SGaist

    Hi and welcome to devnet,

    Where is the ui folder located within your application bundle ?

    T Offline
    T Offline
    T_oni
    wrote on last edited by T_oni
    #3

    @SGaist
    With application bundle you mean the compiled installer, if I understand correctly.
    My MyAppInstaller.app structure is as follows:

    • MyAppInstaller.app
      • Contents
        • Frameworks
        • Info.plist
        • MacOS
          • MyAppInstaller
        • PkgInfo
        • Resources
          • MyAppInstaller.icns
          • installer.dat
            Now that you asked the question I wonder where it should be located....
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      What does the installer do exactly ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      0
      • SGaistS SGaist

        What does the installer do exactly ?

        T Offline
        T Offline
        T_oni
        wrote on last edited by T_oni
        #5

        @SGaist
        (I realised the structure was weirdly missformed, I edited it.)
        The Installer is supposed to install MyApp in the "home directory" which works fine.
        The App is later supposed to start automatically at boot, therefor when the installation-wizard it done, the App is supposed to start automatically.
        (Basically the user shouldn't open the App themselves at all)
        I hope that helped.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          How do you start the application at the end of the installation process ?

          By the way, why the home directory ? That feels odd with regard to macOS standards.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • T Offline
            T Offline
            T_oni
            wrote on last edited by
            #7

            I use the home directory right now, just to have something to test with. I want to change it later, so the user can choose the directory themselves.

            This is the code, to call the application after the installation process:

            function Component()
            {
                installer.installationFinished.connect(this, Component.prototype.installationFinishedPageIsShown);
                installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
            }
            
            Component.prototype.createOperations = function()
            {
                component.createOperations();
            }
            
            Component.prototype.installationFinishedPageIsShown = function()
            {
                try {
                    if (installer.isInstaller() && installer.status == QInstaller.Success) {
                        installer.addWizardPageItem( component, "page", QInstaller.InstallationFinished );
                    }
                } catch(e) {
                    console.log(e);
                }
            }
            
            Component.prototype.installationFinished = function()
            {
                try {
                    if (installer.isInstaller() && installer.status == QInstaller.Success) {
                        	installer.executeDetached(installer.value("TargetDir") + "/myapp/./main.py");
            
                     }
                } catch(e) {
                    console.log(e);
                }
            }
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @T_oni said in Qt app on mac:

              /myapp/./main.py

              That's a strange path.

              Why not start the app bundle ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • T Offline
                T Offline
                T_oni
                wrote on last edited by
                #9

                That is the app bundle (At least in my understanding).
                That is the installed app and inside it (the main.py) is the main code.
                Or is it not? I'm sorry, maybe I didn't understand it correctly?

                artwawA 1 Reply Last reply
                0
                • T T_oni

                  That is the app bundle (At least in my understanding).
                  That is the installed app and inside it (the main.py) is the main code.
                  Or is it not? I'm sorry, maybe I didn't understand it correctly?

                  artwawA Offline
                  artwawA Offline
                  artwaw
                  wrote on last edited by
                  #10

                  @T_oni You should not call anything inside the bundle. By default the bundle (.app) is the only executable you should call.
                  More info https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW13

                  How do you deploy bundle, how do you put deployment files in it? Does it pass the validation from Gatekeeper? Do you sign the code properly?

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  T 1 Reply Last reply
                  0
                  • artwawA artwaw

                    @T_oni You should not call anything inside the bundle. By default the bundle (.app) is the only executable you should call.
                    More info https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW13

                    How do you deploy bundle, how do you put deployment files in it? Does it pass the validation from Gatekeeper? Do you sign the code properly?

                    T Offline
                    T Offline
                    T_oni
                    wrote on last edited by T_oni
                    #11

                    @artwaw
                    Thank you for the link, I will read the information.

                    I used this command to make the executable app with Qt Installer Framework:

                    /Users/myname/Documents/qtinstallerframeworkmac/bin/binarycreator -c config/config.xml -p packages MyAppInstaller.app
                    

                    With this command I than have the installer, that the user is supposed to double-click on to install MyApp. When MyApp is installed it is a folder-structure. And inside that is the main.py that I am executing after the installer is finished. However that only works when I execute the installer over open command.

                    I unfortunately don't know what you mean with "validation from Gatekeeper".
                    I'm going to look into it, though. Thank you.
                    Edit: I have looked into it, however until now I didn't run into Gatekeeper at all with my application. So I'm not sure, if this has anything to do with it. And if, why does my app run fine, when I execute the installer over the terminal?

                    1 Reply Last reply
                    0
                    • T T_oni

                      Hello,

                      I hope I’m even correct to ask this question here.

                      I am working on an app in Qt. The goal is, that the app is running on linux, mac and windows.
                      Right now I ran into a problem on mac.
                      So about the app:
                      The interface is built with Qt Creator, however any code I wrote myself is python.
                      I am using a MacBook Air with Big Sur 11.3.1.
                      I am using Qt 5.14.2

                      With this Code:
                      from qtpy import uic
                      uic.compileUiDir(“ui”)
                      I’m converting the C++ code to python code so I can work with it.

                      I have successfully created an installer for mac with the Qt Installer Framework. I have a wizard which is running fine. After clicking on the “done”-button of the installation wizard, the ui is supposed to open automatically.

                      Now to the problem:
                      When I use the open command (like this: open MyAppInstaller.app) everything is working just fine. The wizard runs through without problem and the ui opens after hitting the “done”-button.
                      However when double-clicking the MyAppInstaller.app the wizard is running completely fine BUT the ui just doesn’t open. And I have no idea why. I’m really confused about this and can’t really find anything that helps.
                      I’m not sure if it’s a difference in the way I open the installer or if it has anything to do with my code. But I feel like, if it was my code the wizard wouldn’t work either….

                      Does anybody have any idea?

                      T Offline
                      T Offline
                      T_oni
                      wrote on last edited by
                      #12

                      Edit: I solved it. Or better said, the problem is gone.
                      I made the application executable by using pyinstaller. I used to just give the command my path to the application. However, my application runs in a virtual environment.
                      Installing pyinstaller in said virtual environment and executing the command while still in the virtual env, the problem with the double-click was resolved.

                      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