Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QT Creator .ui in .pri
Forum Updated to NodeBB v4.3 + New Features

QT Creator .ui in .pri

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
12 Posts 3 Posters 4.6k 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.
  • G Offline
    G Offline
    gmires
    wrote on last edited by
    #1

    In a qt application, for a more correct organization ,
    I have grouped "source", "header" and "ui" into some .pri files.
    I noticed that I can not use the objects ui included in
    .pri if I do not first rebuild, unlike those in .pro.

    PS: the files are all in the same directory.

    Some idea???

    Excuse for my easy english
    Thank's
    Regards

    K 1 Reply Last reply
    0
    • G gmires

      In a qt application, for a more correct organization ,
      I have grouped "source", "header" and "ui" into some .pri files.
      I noticed that I can not use the objects ui included in
      .pri if I do not first rebuild, unlike those in .pro.

      PS: the files are all in the same directory.

      Some idea???

      Excuse for my easy english
      Thank's
      Regards

      K Offline
      K Offline
      koahnig
      wrote on last edited by koahnig
      #2

      @gmires

      Hi and welcome to devnet forum

      You can use also the FORMS variable in a .pri file. You include the .pri file in your .pro file?

      What operation system are you on ?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • G Offline
        G Offline
        gmires
        wrote on last edited by
        #3

        Thanks first of all,
        I included the .pri ne .pro file.
        in .pri I have the HEADERS, SOURCES, AND FORMS variables ..
        If I change the name of an object on forms that are included in .pri if I do not rebuild I can not use it in the source.

        As if for forms not included in the .pri qt creator, I proposed the names of the objects in the .ui file instead of the ones contained in the header created by "uic.exe".

        Thanks
        Reagrds

        K 1 Reply Last reply
        0
        • G gmires

          Thanks first of all,
          I included the .pri ne .pro file.
          in .pri I have the HEADERS, SOURCES, AND FORMS variables ..
          If I change the name of an object on forms that are included in .pri if I do not rebuild I can not use it in the source.

          As if for forms not included in the .pri qt creator, I proposed the names of the objects in the .ui file instead of the ones contained in the header created by "uic.exe".

          Thanks
          Reagrds

          K Offline
          K Offline
          koahnig
          wrote on last edited by koahnig
          #4

          @gmires

          I have simply created a fresh GUI application with creator. Here is the modified .pro:

          #-------------------------------------------------
          #
          # Project created by QtCreator 2017-10-10T16:44:34
          #
          #-------------------------------------------------
          
          QT       += core gui
          
          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
          
          TARGET = untitled
          TEMPLATE = app
          
          # The following define makes your compiler emit warnings if you use
          # any feature of Qt which has 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
          
          #HEADERS += \
          #        mainwindow.h
          
          #FORMS += \
          #        mainwindow.ui
          
          include(untitled.pri)
          

          and here is the .pri file, which is actually a simple copy of .pro and the duplicated lines are deleted.

          #-------------------------------------------------
          #
          # Project created by QtCreator 2017-10-10T16:44:34
          #
          #-------------------------------------------------
          
          SOURCES += \
                  main.cpp \
                  mainwindow.cpp
          
          HEADERS += \
                  mainwindow.h
          
          FORMS += \
                  mainwindow.ui
          

          You might have to be careful, if you bring the .pri file to another folder. Then you need to care of the folder change as well. Also you need to use the continuation character (backslash) for adding new lines.

          And this is how it should look in the project pane of Qt creator
          0_1507647178987_6a53b4d1-065e-47be-9302-02c123d57206-image.png

          [edit: koahnig] Just in case do also a rerun of qmake and a rebuild in Qt creator.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gmires
            wrote on last edited by
            #5

            Is what I did practically,
            I attach you a photo..
            in fact everything works correctly, it only seems strange that if I modify the form that is not included in the .pri I can use the objects without rebuilding qmake or rebuild, if instead modifying those included, if qmake and rebuild do not find them in ui-> on the source.

            FILE .pro

            #-------------------------------------------------
            #
            # Project created by QtCreator 2017-05-24T15:00:59
            #
            #-------------------------------------------------
            
            QT       += core gui sql network
            
            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
            
            TARGET = orisplayer
            TEMPLATE = app
            
            SOURCES += main.cpp\
                    mainwindow.cpp \
                db_record.cpp \
                db_manager.cpp \
                db_tb_configure.cpp \
                mainconfigura.cpp \
                configura01.cpp \
                configura02.cpp \
                configura03.cpp \
                configura04.cpp \
                configura04_item.cpp \
                attesa.cpp \
                db_tb_campane.cpp \
                configura05_ore01.cpp \
                configura05_ore02.cpp \
                configura06_save.cpp \
                conferma.cpp \
                configura_loc.cpp \
                db_config.cpp \
                utility.cpp \
                configura_lan.cpp \
                maincalendar.cpp
            
            HEADERS  += mainwindow.h \
                defines.h \
                db_record.h \
                db_manager.h \
                db_tb_configure.h \
                mainconfigura.h \
                configura01.h \
                configura02.h \
                ipage.h \
                configura03.h \
                configura04.h \
                configura04_item.h \
                attesa.h \
                db_tb_campane.h \
                configura05_ore01.h \
                configura05_ore02.h \
                configura06_save.h \
                conferma.h \
                configura_loc.h \
                db_config.h \
                utility.h \
                configura_lan.h \
                maincalendar.h
            
            FORMS    += mainwindow.ui \
                mainconfigura.ui \
                configura01.ui \
                configura02.ui \
                configura03.ui \
                configura04.ui \
                configura04_item.ui \
                attesa.ui \
                configura05_ore01.ui \
                configura05_ore02.ui \
                configura06_save.ui \
                conferma.ui \
                configura_loc.ui \
                configura_lan.ui \
                maincalendar.ui
            
            include(keyboard.pri)
            
            target.path = /root/APP
            
            INSTALLS += target
            
            RESOURCES += \
                resources.qrc
            
            unix:!macx: LIBS += -L$$PWD/../../qxwidget-project/build-qxwidgets-DVM28-Release/ -lqxwidgets
            
            INCLUDEPATH += $$PWD/../../qxwidget-project/qxwidgets
            DEPENDPATH += $$PWD/../../qxwidget-project/qxwidgets
            
            unix:!macx: PRE_TARGETDEPS += $$PWD/../../qxwidget-project/build-qxwidgets-DVM28-Release/libqxwidgets.a
            
            

            FILE .pri

            HEADERS += keyboard.h \
            	pinpad.h \ 
                    datetimepad.h
            
            SOURCES += keyboard.cpp \
            	pinpad.cpp \
                    datetimepad.cpp
            
            FORMS += pinpad.ui \
                datetimepad.ui
            
            
            K Pablo J. RoginaP 2 Replies Last reply
            0
            • G gmires

              Is what I did practically,
              I attach you a photo..
              in fact everything works correctly, it only seems strange that if I modify the form that is not included in the .pri I can use the objects without rebuilding qmake or rebuild, if instead modifying those included, if qmake and rebuild do not find them in ui-> on the source.

              FILE .pro

              #-------------------------------------------------
              #
              # Project created by QtCreator 2017-05-24T15:00:59
              #
              #-------------------------------------------------
              
              QT       += core gui sql network
              
              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
              
              TARGET = orisplayer
              TEMPLATE = app
              
              SOURCES += main.cpp\
                      mainwindow.cpp \
                  db_record.cpp \
                  db_manager.cpp \
                  db_tb_configure.cpp \
                  mainconfigura.cpp \
                  configura01.cpp \
                  configura02.cpp \
                  configura03.cpp \
                  configura04.cpp \
                  configura04_item.cpp \
                  attesa.cpp \
                  db_tb_campane.cpp \
                  configura05_ore01.cpp \
                  configura05_ore02.cpp \
                  configura06_save.cpp \
                  conferma.cpp \
                  configura_loc.cpp \
                  db_config.cpp \
                  utility.cpp \
                  configura_lan.cpp \
                  maincalendar.cpp
              
              HEADERS  += mainwindow.h \
                  defines.h \
                  db_record.h \
                  db_manager.h \
                  db_tb_configure.h \
                  mainconfigura.h \
                  configura01.h \
                  configura02.h \
                  ipage.h \
                  configura03.h \
                  configura04.h \
                  configura04_item.h \
                  attesa.h \
                  db_tb_campane.h \
                  configura05_ore01.h \
                  configura05_ore02.h \
                  configura06_save.h \
                  conferma.h \
                  configura_loc.h \
                  db_config.h \
                  utility.h \
                  configura_lan.h \
                  maincalendar.h
              
              FORMS    += mainwindow.ui \
                  mainconfigura.ui \
                  configura01.ui \
                  configura02.ui \
                  configura03.ui \
                  configura04.ui \
                  configura04_item.ui \
                  attesa.ui \
                  configura05_ore01.ui \
                  configura05_ore02.ui \
                  configura06_save.ui \
                  conferma.ui \
                  configura_loc.ui \
                  configura_lan.ui \
                  maincalendar.ui
              
              include(keyboard.pri)
              
              target.path = /root/APP
              
              INSTALLS += target
              
              RESOURCES += \
                  resources.qrc
              
              unix:!macx: LIBS += -L$$PWD/../../qxwidget-project/build-qxwidgets-DVM28-Release/ -lqxwidgets
              
              INCLUDEPATH += $$PWD/../../qxwidget-project/qxwidgets
              DEPENDPATH += $$PWD/../../qxwidget-project/qxwidgets
              
              unix:!macx: PRE_TARGETDEPS += $$PWD/../../qxwidget-project/build-qxwidgets-DVM28-Release/libqxwidgets.a
              
              

              FILE .pri

              HEADERS += keyboard.h \
              	pinpad.h \ 
                      datetimepad.h
              
              SOURCES += keyboard.cpp \
              	pinpad.cpp \
                      datetimepad.cpp
              
              FORMS += pinpad.ui \
                  datetimepad.ui
              
              
              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              @gmires said in QT Creator .ui in .pri:

              in fact everything works correctly, it only seems strange that if I modify the form that is not included in the .pri I can use the objects without rebuilding qmake or rebuild, if instead modifying those included, if qmake and rebuild do not find them in ui-> on the source.

              Oh, you mean the autocompletion in Qt creator while referencing new objects or modified objects which are part of the pinpad.ui and/or datetimepad.ui in your case?

              Vote the answer(s) that helped you to solve your issue(s)

              G 1 Reply Last reply
              0
              • G Offline
                G Offline
                gmires
                wrote on last edited by
                #7

                I attach you a photo
                operating system : Ubutnu x64 17.04

                0_1507648181780_qt.jpeg

                1 Reply Last reply
                0
                • K koahnig

                  @gmires said in QT Creator .ui in .pri:

                  in fact everything works correctly, it only seems strange that if I modify the form that is not included in the .pri I can use the objects without rebuilding qmake or rebuild, if instead modifying those included, if qmake and rebuild do not find them in ui-> on the source.

                  Oh, you mean the autocompletion in Qt creator while referencing new objects or modified objects which are part of the pinpad.ui and/or datetimepad.ui in your case?

                  G Offline
                  G Offline
                  gmires
                  wrote on last edited by
                  #8

                  @koahnig
                  yes just this,
                  did not cause malfunctions, but it was just to understand.

                  Thank's

                  K 1 Reply Last reply
                  0
                  • G gmires

                    @koahnig
                    yes just this,
                    did not cause malfunctions, but it was just to understand.

                    Thank's

                    K Offline
                    K Offline
                    koahnig
                    wrote on last edited by
                    #9

                    @gmires

                    I have seen similar or the same behaviour on win 10 64 bit with creator. .pro file does not hold any source, header or ui and therefore, it is a sort of standard behaviour I have seen. Probably it is a bug then judging from what you have noticed.

                    You can check on JIRA, if there is already a bug report filed and file one, if not.

                    Vote the answer(s) that helped you to solve your issue(s)

                    1 Reply Last reply
                    1
                    • G gmires

                      Is what I did practically,
                      I attach you a photo..
                      in fact everything works correctly, it only seems strange that if I modify the form that is not included in the .pri I can use the objects without rebuilding qmake or rebuild, if instead modifying those included, if qmake and rebuild do not find them in ui-> on the source.

                      FILE .pro

                      #-------------------------------------------------
                      #
                      # Project created by QtCreator 2017-05-24T15:00:59
                      #
                      #-------------------------------------------------
                      
                      QT       += core gui sql network
                      
                      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                      
                      TARGET = orisplayer
                      TEMPLATE = app
                      
                      SOURCES += main.cpp\
                              mainwindow.cpp \
                          db_record.cpp \
                          db_manager.cpp \
                          db_tb_configure.cpp \
                          mainconfigura.cpp \
                          configura01.cpp \
                          configura02.cpp \
                          configura03.cpp \
                          configura04.cpp \
                          configura04_item.cpp \
                          attesa.cpp \
                          db_tb_campane.cpp \
                          configura05_ore01.cpp \
                          configura05_ore02.cpp \
                          configura06_save.cpp \
                          conferma.cpp \
                          configura_loc.cpp \
                          db_config.cpp \
                          utility.cpp \
                          configura_lan.cpp \
                          maincalendar.cpp
                      
                      HEADERS  += mainwindow.h \
                          defines.h \
                          db_record.h \
                          db_manager.h \
                          db_tb_configure.h \
                          mainconfigura.h \
                          configura01.h \
                          configura02.h \
                          ipage.h \
                          configura03.h \
                          configura04.h \
                          configura04_item.h \
                          attesa.h \
                          db_tb_campane.h \
                          configura05_ore01.h \
                          configura05_ore02.h \
                          configura06_save.h \
                          conferma.h \
                          configura_loc.h \
                          db_config.h \
                          utility.h \
                          configura_lan.h \
                          maincalendar.h
                      
                      FORMS    += mainwindow.ui \
                          mainconfigura.ui \
                          configura01.ui \
                          configura02.ui \
                          configura03.ui \
                          configura04.ui \
                          configura04_item.ui \
                          attesa.ui \
                          configura05_ore01.ui \
                          configura05_ore02.ui \
                          configura06_save.ui \
                          conferma.ui \
                          configura_loc.ui \
                          configura_lan.ui \
                          maincalendar.ui
                      
                      include(keyboard.pri)
                      
                      target.path = /root/APP
                      
                      INSTALLS += target
                      
                      RESOURCES += \
                          resources.qrc
                      
                      unix:!macx: LIBS += -L$$PWD/../../qxwidget-project/build-qxwidgets-DVM28-Release/ -lqxwidgets
                      
                      INCLUDEPATH += $$PWD/../../qxwidget-project/qxwidgets
                      DEPENDPATH += $$PWD/../../qxwidget-project/qxwidgets
                      
                      unix:!macx: PRE_TARGETDEPS += $$PWD/../../qxwidget-project/build-qxwidgets-DVM28-Release/libqxwidgets.a
                      
                      

                      FILE .pri

                      HEADERS += keyboard.h \
                      	pinpad.h \ 
                              datetimepad.h
                      
                      SOURCES += keyboard.cpp \
                      	pinpad.cpp \
                              datetimepad.cpp
                      
                      FORMS += pinpad.ui \
                          datetimepad.ui
                      
                      
                      Pablo J. RoginaP Offline
                      Pablo J. RoginaP Offline
                      Pablo J. Rogina
                      wrote on last edited by
                      #10

                      @gmires is it me but I cannot see where in your .pro file you actually include your .pri file? As explained here for instance.

                      Upvote the answer(s) that helped you solve the issue
                      Use "Topic Tools" button to mark your post as Solved
                      Add screenshots via postimage.org
                      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                      K 1 Reply Last reply
                      0
                      • Pablo J. RoginaP Pablo J. Rogina

                        @gmires is it me but I cannot see where in your .pro file you actually include your .pri file? As explained here for instance.

                        K Offline
                        K Offline
                        koahnig
                        wrote on last edited by koahnig
                        #11

                        @Pablo-J.-Rogina

                        It is

                        include(keyboard.pri)
                        

                        Further down in file.pro. His reference to File.pri is actually not correct, but you can see from the screenshot given later.

                        Vote the answer(s) that helped you to solve your issue(s)

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          gmires
                          wrote on last edited by
                          #12

                          @Pablo-J-Rogina , @koahnig

                          I tried to include the .pri file in various parts of .pro to see if it could depend on it
                          Reagards

                          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