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. [Solved] ui_*.h files generated in wrong directory
Forum Updated to NodeBB v4.3 + New Features

[Solved] ui_*.h files generated in wrong directory

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 11.0k 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.
  • S Offline
    S Offline
    SumRandomGuy
    wrote on last edited by
    #1

    I noticed that I could make updates to my application and they'd work just fine except when I tried to update my GUI. I'd make a change to a form but it wouldn't reflect in the application when run.

    I did some research and found out the ui_.h files were being generated in the release directory instead of the project folder. When I move the ui_.h files into the project folder and rebuild, they're reflected in my GUI.

    I saw mention to set UI_DIR in the *.pro file but I'm not sure what to set it to. Is there a better way to fix this? If not, what do I set that value to in the *.pro file. If I set it like:
    UI_DIR = ui
    It creates a ui directory in the build directory instead of in the project directory.

    Thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      I would think that you would want your uic-created files to live in the build directory rather than the project directory, as they are temporary files which are built at compile time for that particular build instance.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SumRandomGuy
        wrote on last edited by
        #3

        That makes sense. What can I do so I don't have to copy them to the project directory to get the updates when I build?

        If I don't copy the ui_*.h files to my project directory, my UI never sees the changes I make. I can change a label's text but unless I copy those files, my app still has the old text.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SumRandomGuy
          wrote on last edited by
          #4

          I should also mention that if I just delete the ui_*.h files from my project directory and expect the ones in the build directory to be chosen, it fails to find them at all. It just isn't looking in the build directory for these files at all.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mlong
            wrote on last edited by
            #5

            what do your #include statements for the ui_*.h look like? Anything strange in your .pro file?

            Does re-running qmake after you make a change help things?

            Software Engineer
            My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SumRandomGuy
              wrote on last edited by
              #6

              Here's the .pro file:

              @#-------------------------------------------------

              Project created by QtCreator 2012-11-12T11:57:23

              #-------------------------------------------------

              QT += core gui sql

              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

              TARGET = TheDirector
              TEMPLATE = app

              SOURCES += main.cpp
              mainwindow.cpp
              accountdetails.cpp
              botprofile.cpp
              aboutbox.cpp
              editallprofiledetails.cpp
              editdirectorsettings.cpp
              botsettings.cpp
              autorundelegate.cpp

              HEADERS += mainwindow.h
              accountdetails.h
              botprofile.h
              aboutbox.h
              editallprofiledetails.h
              editdirectorsettings.h
              botsettings.h
              autorundelegate.h

              FORMS += mainwindow.ui
              accountdetails.ui
              aboutbox.ui
              editallprofiledetails.ui
              editdirectorsettings.ui

              #UI_DIR = ui

              RESOURCES +=

              win32 {
              QMAKE_LFLAGS += -static
              CONFIG += -no-exceptions
              } else {
              }
              @

              and the includes aren't anything special. Here's the entirety of one of the .cpp files:
              @#include "editallprofiledetails.h"
              #include "ui_editallprofiledetails.h"

              EditAllProfileDetails::EditAllProfileDetails(QWidget *parent) :
              QDialog(parent),
              ui(new Ui::EditAllProfileDetails)
              {
              ui->setupUi(this);

              this->AllProfileDetailsModel = new QSqlTableModel(this, QSqlDatabase::database("DirectorDB"));
              AllProfileDetailsModel->setTable("profiles");
              AllProfileDetailsModel->select();
              ui->tblAllProfiles->setModel( AllProfileDetailsModel );
              

              }

              EditAllProfileDetails::~EditAllProfileDetails()
              {
              delete ui;
              }
              @

              Running qmake doesn't change anything for me. It happens the same whether I build from within Qt Creator or via the command line manually.

              Odd, huh?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SumRandomGuy
                wrote on last edited by
                #7

                Resources are doing the same thing to me. I can't add resources because it doesn't find them in the right directory to be linked.

                When I create a new object, I have copy files for the code-completion thing to work.

                I have workarounds but would love to know if there's a configuration option I've set wrong. I should say that this is a new install. It's not like it was working, then stopped, so it's likely something I'm doing wrong.

                It happens on my Windows and my Mac environment.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mlong
                  wrote on last edited by
                  #8

                  You're not, by chance, sharing the .pro.user file across platforms, are you?

                  Software Engineer
                  My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SumRandomGuy
                    wrote on last edited by
                    #9

                    Yes. I've been copying the directory over when I want to develop on a different machine.... That's bad, huh?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mlong
                      wrote on last edited by
                      #10

                      Yeah, the .pro.user file is specific to one particular instance of Creator and is not portable between systems, users, platforms, or whatever. Sharing it is a Bad Idea. Try getting rid of it and see if your problems still exist.

                      Software Engineer
                      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SumRandomGuy
                        wrote on last edited by
                        #11

                        That resolved it. Thanks!

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mlong
                          wrote on last edited by
                          #12

                          Good deal! Be sure and edit the thread title to add [Solved]. Thanks!

                          Software Engineer
                          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                          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