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