Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. MacOS deploying styles
Forum Updated to NodeBB v4.3 + New Features

MacOS deploying styles

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 2 Posters 5.4k Views 1 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.
  • R Offline
    R Offline
    rivierakid
    wrote on last edited by
    #1

    Hi, I've compiled the qtstyleplugins under qt5.0.0 osx. It works only without deploying libraries into the app bundle (macdeployqt).
    If I try to run the app:
    @Class NotificationReceiver is implemented in both /app-bundle-path.../QtWidgets and /qt-abs-path/QtWidgets. One of the two will be used. Which is undefined.
    Abort trap@

    otool -L test.app/Contents/PlugIns/libqplastiquestyle.dylib

    • All qt-libraries are located under @executable_path/../Frameworks - no absolute path...

    Is it possible to deploy qtstyleplugins inside the app-bundle?

    Thanks for help.
    Martin

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

      Hi,

      Check that your executable and other dependencies also have their path updated (even Qt libraries to be sure)

      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
      • R Offline
        R Offline
        rivierakid
        wrote on last edited by
        #3

        The problem is probably not with qtstyleplugins.
        My program:
        @int main(int argc, char *argv[]) {
        QApplication::setStyle("xxx");
        QApplication app(argc, argv);@

        The style "xxx" doesn't exist, this application runs in default osx style - without deploying. After deploying it shows the error above...
        otool -L for every library (including executable) in the bundle returns correct paths (@executable_path)

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

          Did you check what QStyleFactory::keys() returns ?

          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
          • R Offline
            R Offline
            rivierakid
            wrote on last edited by
            #5

            No custom style used:

            @#include "mainwindow.h"
            #include <QApplication>
            #include <qstylefactory.h>
            #include <qdebug.h>

            int main(int argc, char *argv[])
            {
            qDebug() << QStyleFactory::keys();

            QApplication a(argc, argv);
            MainWindow w;
            w.show();
            
            return a.exec&#40;&#41;;
            

            }@

            ("Windows", "Fusion", "Macintosh")
            objc[2880]: Class NotificationReceiver is implemented in both /Users/martin.dusek/cpp/teststyle-build-5_0_0_x64-Release/teststyle.app/Contents/MacOS/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets and /usr/local/qt-5.0.0/x64/lib/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.
            QObject::moveToThread: Current thread (0x102712a10) is not the object's thread (0x102719830).
            Cannot move to target thread (0x102712a10)

            On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
            Failed to load platform plugin "cocoa". Available platforms are:
            cocoa
            minimal
            minimal

            Abort trap

            Without deploying:
            (“Windows”, “Fusion”, “Macintosh”)

            • no crash

            Deployed + commented out this line:
            @//qDebug() << QStyleFactory::keys();@

            • no crash

            It looks like that any touch to QStyle in OSX = crash :(

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

              The error message you get tells you that not all your libs/exec are linked against the same Qt which means that at least one of your dependencies has not the proper paths set (have you also the plugins in the bundle ? Did you "otool" them ?)

              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
              • R Offline
                R Offline
                rivierakid
                wrote on last edited by
                #7

                All dependencies are prefixed with @executable_path. It is really strange...

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

                  For all Qt libraries ?

                  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
                  • R Offline
                    R Offline
                    rivierakid
                    wrote on last edited by
                    #9

                    yes.

                    This is OK:
                    @QApplication a(argc, argv);
                    qDebug() << QStyleFactory::keys();@

                    This crashes:
                    @qDebug() << QStyleFactory::keys();
                    QApplication a(argc, argv);@

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rivierakid
                      wrote on last edited by
                      #10

                      @QApplication a(argc, argv);
                      QApplication::setStyle("plastique");@

                      Works!
                      There is a hint in qt-docs - QApplication::setStyle
                      To ensure that the application's style is set correctly, it is best to call this function before the QApplication constructor, if possible.

                      This is impossible on mac...

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

                        Time to use
                        @#ifdef Q_OS_MACX@

                        unless it's a mac only app

                        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

                        • Login

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