Install a package from qt-solutions

  • Hi,

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

    I donwloaded 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.
    Command make not found

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


  • Qt Champions 2018

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

  • 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?

  • Lifetime Qt Champion


    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.

  • 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?

  • Lifetime Qt Champion

    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.

  • 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?

  • Lifetime Qt Champion

    /plugins/qtsingleapplication/config.pri ?

    Where exactly did you put that into your project ?

  • 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:


  • Lifetime Qt Champion

    Can you share your .pro file ?

  • 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
    # 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.
    # 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 \
    HEADERS  += mainwindow.h \
        components/codeeditor.h \
        components/highlighter.h \
        components/projectmodel.h \
        dialogs/newproject.h \
        dialogs/newtabledialog.h \
    FORMS    += mainwindow.ui \
        dialogs/newproject.ui \
        dialogs/newtabledialog.ui \
    DISTFILES += \
        appIcon/phpPad.rc \
        Erungenschaften.txt \
    RESOURCES += \
    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.

  • Lifetime Qt Champion

    What did you copy exactly from the QtSolutions module ?

  • 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


  • Lifetime Qt Champion

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

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

  • Lifetime Qt Champion

    AFAIR you should essentially need:

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

  • Qt Champions 2018

    @SGaist += not *=

  • Moderators

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

    @SGaist += not *=

    *= is perfectly fine. See the docs

  • Qt Champions 2018

    @sierdzio Oh, good to know :-)

  • 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

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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.