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. Install a package from qt-solutions
Forum Updated to NodeBB v4.3 + New Features

Install a package from qt-solutions

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 4 Posters 6.7k Views 3 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.
  • SikarjanS Sikarjan

    Hi,

    I would like to add qtsingleapplication from qt-solutions to my Qt installation but I do not understand the install instructions.

    I donwloaded qt.solutions as zip to my download folder and unzipped it. On OS X I used the Terminal to run configure. On Windows I used the Qt5.6 for Desktop (MinGW 4.9.2 32bit) command line(?) to run configure.bat. On both systems that seed to work. On OS X the next step did not work. qmake command not found. On windows qmake worked but make did not:

    C:\Users\USER\Downloads\qt-solutions-master\qtsingleapplication> configure.bat
    .
    This component is now configured.
    .
    To build the component library (if requested) and example(s), run qmake and your make or nmake command.
    .
    To remove or reconfigure, run make (nmake) distclean.
    .
    
    C:\Users\USER\Downloads\qt-solutions-master\qtsingleapplication>qmake
    
    C:\Users\USER\Downloads\qt-solutions-master\qtsingleapplication>make
    Command make not found
    

    So what did I do wrong? How do I get this package installed?

    Thanks

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @Sikarjan Which compiler do you use on Windows? If Microsoft then use nmake.exe, if MinGW then use mingw32-make.exe.
    On MacOS: did you install Qt? If you did then try to provide absolute path to qmake executable.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    2
    • SikarjanS Offline
      SikarjanS Offline
      Sikarjan
      wrote on last edited by
      #3

      Thanks for the help. As noob this was not obvious for me.

      the qmake and make commands worked with mingw32-make.exe on Windows and the full path on OS X. The make command produced a lot of output. Not sure if this is a good or bad sign...

      The Install file says to use the package I have to include(your-install-dir/some-package/src/some-package.pri). I assumed that your-install-dir is the directory Qt is installed in. So in my Windows case C:\Qt\5.6\mingw49_32 but the entire Qt folder has no qtsingleapplication file.

      Was it a mistake to leave the extracted files in my Downloads folder? Should I have moved the files somewhere else before running configure?

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

        Hi,

        The path is where the concerned .pri file is located.

        The QtSolutions module isn't handled the same way as the other more recent modules.

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

          At the moment this would be my Downloads folder, which is probably not the best location, is it? Can I move the folder or do I have to rebuild the module when I relocate it? If I can just move it where should the folder go?

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

            The idea behind using the .pri file is to build the solution within your project rather than have it as external dependency.

            What I saw people usually do is to copy the content of the solution they are interested in in their own code base and include the .pri file.

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

              Okay. And this also works if I use the code cross platform? So I can take the files I created on Windows to my Mac and it will also work? If that is so, why do I need to configure and make the files then?

              Just tried it on Windows but did not work. I created a folder plugins in my main folder and copied the qtsingleapplicaiton folder there. When I add the path in my pro file I receive an error:

              /plugins/qtsingleapplication/config.pri: No such file or directory
              

              This file does not exist. When I try to build my app anyway it fails too:

              C:\...\phpPad\plugins\qtsingleapplication\src\qtlocalpeer.cpp:180: Warnung: comparison between 'enum QLocalSocket::LocalSocketState' and 'enum QAbstractSocket::SocketState' [-Wenum-compare]
                       if (socket->state() == QAbstractSocket::UnconnectedState) {
                                                               ^
              

              I tried to remove the server/peer functionality since I do not need that but that caused other errors.

              Am I facing theses errors because I copied the folder or is this an issue with the code itself and not my fault?

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

                /plugins/qtsingleapplication/config.pri ?

                Where exactly did you put that into your project ?

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

                  I do not have it in my project. It is also not provided but required by common.pri:

                  exists(config.pri):infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtsingleapplication-uselib
                  

                  The common.pri file is required by qtsingleapplication.pri:

                  include(../common.pri)
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Can you share your .pro file ?

                    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
                    • SikarjanS Offline
                      SikarjanS Offline
                      Sikarjan
                      wrote on last edited by
                      #11

                      Sure I can:

                      #-------------------------------------------------
                      #
                      # Project created by QtCreator 2017-01-05T07:43:22
                      #
                      #-------------------------------------------------
                      
                      QT       += core gui xml
                      
                      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                      
                      TARGET = phpPad
                      TEMPLATE = app
                      
                      include(plugins/qtsingleapplication/src/qtsingleapplication.pri)
                      
                      # The following define makes your compiler emit warnings if you use
                      # any feature of Qt which as been marked as deprecated (the exact warnings
                      # depend on your compiler). Please consult the documentation of the
                      # deprecated API in order to know how to port your code away from it.
                      DEFINES += QT_DEPRECATED_WARNINGS
                      
                      # You can also make your code fail to compile if you use deprecated APIs.
                      # In order to do so, uncomment the following line.
                      # You can also select to disable deprecated APIs only up to a certain version of Qt.
                      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                      
                      SOURCES += main.cpp\
                              mainwindow.cpp \
                          components/codeeditor.cpp \
                          components/highlighter.cpp \
                          components/projectmodel.cpp \
                          dialogs/newproject.cpp \
                          dialogs/newtabledialog.cpp \
                          dialogs/preferencedialog.cpp
                      
                      HEADERS  += mainwindow.h \
                          components/codeeditor.h \
                          components/highlighter.h \
                          components/projectmodel.h \
                          dialogs/newproject.h \
                          dialogs/newtabledialog.h \
                          dialogs/preferencedialog.h
                      
                      FORMS    += mainwindow.ui \
                          dialogs/newproject.ui \
                          dialogs/newtabledialog.ui \
                          dialogs/preferencedialog.ui
                      
                      DISTFILES += \
                          appIcon/phpPad.rc \
                          Erungenschaften.txt \
                          xml/html.xml
                      
                      RESOURCES += \
                          qrc.qrc
                      
                      ICON = appIcon/phpPad.icns
                      
                      RC_FILE = appIcon/phpPad.rc
                      
                      

                      I believe the issue is with the client/peer feature. This feature is not relevant for me. Somewhere in the documentation I read the the minimal example is not making use of this feature but it uses the same files. So I don't get how they did it.

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

                        What did you copy exactly from the QtSolutions module ?

                        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
                        • SikarjanS Offline
                          SikarjanS Offline
                          Sikarjan
                          wrote on last edited by
                          #13

                          Currently I am trying all of this only on Windows.

                          I downloaded the entire solutions package from github as zip. Extracted it in my Downloads folder and followed the install instruction within the qtsingleapplicaition folder. Then I copied the entire qtsingeapplication folder and pasted it in the plugin folder which is in my root folder. From the qtsingleapplication folder I removed the configure, make, docs and examples. The src and buildlib folder is untouched.

                          This is the content of my qtsingeapplication folder

                          buildlib
                          src
                          common.pri
                          qtsingleapplication.pro
                          
                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            Where is your project source located on your machine ?
                            Same question for QtSolution sources.

                            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
                            • SikarjanS Offline
                              SikarjanS Offline
                              Sikarjan
                              wrote on last edited by
                              #15

                              On Windows my files are in my standard Windows documents folder. On OS X under User/Programming. The qtsingleapplication folder is in the project folder under plugins. The rest of the QtSolution files is still in my Download folder.

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

                                AFAIR you should essentially need:

                                INCLUDEPATH += $$PWD
                                DEPENDPATH += $$PWD
                                QT *= network
                                greaterThan(QT_MAJOR_VERSION, 4): QT *= widgets
                                
                                SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
                                HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
                                

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

                                jsulmJ 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  AFAIR you should essentially need:

                                  INCLUDEPATH += $$PWD
                                  DEPENDPATH += $$PWD
                                  QT *= network
                                  greaterThan(QT_MAJOR_VERSION, 4): QT *= widgets
                                  
                                  SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
                                  HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
                                  
                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #17

                                  @SGaist += not *=
                                  :-)

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  sierdzioS 1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    @SGaist += not *=
                                    :-)

                                    sierdzioS Offline
                                    sierdzioS Offline
                                    sierdzio
                                    Moderators
                                    wrote on last edited by
                                    #18

                                    @jsulm said in Install a package from qt-solutions:

                                    @SGaist += not *=
                                    :-)

                                    *= is perfectly fine. See the docs

                                    (Z(:^

                                    jsulmJ 1 Reply Last reply
                                    1
                                    • sierdzioS sierdzio

                                      @jsulm said in Install a package from qt-solutions:

                                      @SGaist += not *=
                                      :-)

                                      *= is perfectly fine. See the docs

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #19

                                      @sierdzio Oh, good to know :-)
                                      Thanks!

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • SikarjanS Offline
                                        SikarjanS Offline
                                        Sikarjan
                                        wrote on last edited by
                                        #20

                                        Thanks for all you help and time. I got it working finally. Probably not the most elegant way but it works for me =)

                                        @SGaist your suggestion worked (after I figured out to remove the include statement) but it included the files directly into my project messing up my structure in Creator. Also it gave me an error in my main.cpp on #include <qtsingleapplication.h> no such file

                                        Essentially only the network module was missing.

                                        QT       += core gui xml network
                                        
                                        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                                        
                                        TARGET = phpPad
                                        TEMPLATE = app
                                        
                                        include(plugins/qtsingleapplication/src/qtsingleapplication.pri)
                                        

                                        I am very sure that I tried to include that before with a clean and rebuild. No idea why it is working now.

                                        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