PDA

View Full Version : qt designer has no effect on the application



Saurian
23rd June 2015, 06:15
Hello to everyone,

I have a problem with a little application I'm working at. I created a GUI and if I want to change some things from the GUI (for example set a title for the main window of the application or change the tab order of some buttons and textedits ), even though in Qt Designer the changes are saved, at runtime I see no changes in the application. Can anyone give me an advice about what to do? I tried to delete the debug folder created by Qt when I press Run, I tried to clean and rebuild the project and nothing. However, if I make some changes in the code the application acts as my code is telling. And I don't get any kind of warnings.

Thanks in advance!

ChrisW67
23rd June 2015, 09:18
Is the UI file you are editing listed in the PRO file FORMS variable?
Does the compile output show it attempting to build your UI?
Are the timestamps on your files good?

Saurian
23rd June 2015, 22:02
Thank you for your answer. Now to answer your questions.
1. The UI file I am editing is listed in the pro file forms variable.
2. The compile output when I run the application is:

19:08:00: Running steps for project conturi...
19:08:00: Configuration unchanged, skipping qmake step.
19:08:00: Starting: "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw491_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/aplicatie_conturi/build-conturi-Desktop_Qt_5_4_2_MinGW_32bit-Debug'
mingw32-make[1]: Nothing to be done for 'first'.
mingw32-make[1]: Leaving directory 'C:/aplicatie_conturi/build-conturi-Desktop_Qt_5_4_2_MinGW_32bit-Debug'
19:08:01: The process "C:\Qt\Tools\mingw491_32\bin\mingw32-make.exe" exited normally.
19:08:01: Elapsed time: 00:01.

where 'C:/aplicatie_conturi/build-conturi-Desktop_Qt_5_4_2_MinGW_32bit-Debug' is the folder built for the application.
3. I don't understand your question. How can I check if the timestamps on my files are good?

yeye_olive
24th June 2015, 09:35
As part of its job building your program, mingw32-make is supposed to do the following whenever you modify your UI file (which I named foowidget.ui):

run uic to generate a header ui_foowidget.h from foowidget.ui;
recompile every C++ source file that includes ui_foowidget.h (for instance, foowidget.cpp);
run the linker to produce the executable (let us call it barprogram.exe).

Therefore, after a successful build, if you order the files from least recently modified to most recently modified, you should have foowidget.ui, then ui_foowidget.h, then foowidget.o (or is it foowidget.obj?), then barprogram.exe.

Run mingw32-make, and have a look at the timestamps of these files to check that they are in the expected order. From what you describe, it looks like step 1 above is not performed, which would be confirmed if, after a build, foowidget.ui were more recent than ui_foowidget.h.

Oh, and please also do a clean build of your project (make clean, qmake, make). Could you also post your .pro file?

Saurian
24th June 2015, 19:03
yeye_olive, that's it. The file mainwindow.ui is more recent than ui_mainwindow.h. Why is that? Is there any solution to that? I've read from other places that I should delete the file ui_mainwindow.h. Isn't there an official solution from Qt? If I do a clean and run qmake and after that build, it has no effect.

The content of my .pro file is:


#-------------------------------------------------
#
# Project created by QtCreator 2014-05-11T22:21:26
#
#-------------------------------------------------

QT += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

#QMAKE_LFLAGS += /INCREMENTAL:NO

TARGET = conturi
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp

HEADERS += mainwindow.h

FORMS += mainwindow.ui

ChrisW67
24th June 2015, 21:15
Completely delete the shadow build directory and rebuild the project.

Saurian
25th June 2015, 03:48
I've already tried that and had no effect.

d_stranz
25th June 2015, 23:16
Have you checked to make sure it isn't something really dumb (and easily overlooked) like the name of the file being misspelled in in either the .pro file or the place where the header is being included? Are you on a case-sensitive OS?

Saurian
26th June 2015, 11:08
Hard to believe. The .pro file was automatic created and I didn't change anything to do with the name of my files. The only thing I changed in the .pro file was at the lines:



QT += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

#QMAKE_LFLAGS += /INCREMENTAL:NO


when I used the sql library (to work with sqlite) or when I moved the project on Ubuntu and back on Windows.

Saurian
28th June 2015, 06:45
I, finally, found the problem. In my application's folder, aplicatie_conturi, there was already a version of the ui_mainwindow.h created by Qt a while ago and the path was changed at a certain point for creating the exe file with ui_mainwindow.h and all in another folder. So when I was building the project, Qt seems that was using the files from the application source files' folder.

d_stranz
28th June 2015, 17:01
Have you checked to make sure it isn't something really dumb (and easily overlooked) like ... the place where the header is being included?

How many times have we all done something like that? :cool:

Saurian
11th April 2018, 17:22
So I have exactly the same issue but this time is on Ubuntu 16.04 and there is no ui_mainwindow.h file. I tried to delete the shadow build, delete the make file, clean, qmake, build and the same. At a certain point I deleted the executable file from the application directory and apparently Qt can't generate a new executable. I'm getting the error message: "Executable path_to_executable does not exist."

Anyone has any idea what the issue may be?

Saurian
12th April 2018, 16:29
Apparently the issue is that make doesn't generate any executable from Makefile. If I delete Makefile and try to run make (either through Qt or directly from the terminal) I'm getting the following compile output:



make: Nothing to be done for 'first'.


If I try to generate Makefile from Terminal running qmake conturi.pro I'm getting the following Makefile:



################################################## ###########################
# Makefile for building: conturi
# Generated by qmake (2.01a) (Qt 4.8.7) on: Jo apr. 12 18:27:22 2018
# Project: conturi.pro
# Template: subdirs
# Command: /usr/lib/x86_64-linux-gnu/qt4/bin/qmake -o Makefile conturi.pro
################################################## ###########################

first: make_default
MAKEFILE = Makefile
QMAKE = /usr/lib/x86_64-linux-gnu/qt4/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
SUBTARGETS =


Makefile: conturi.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/common/gcc-base.conf \
/usr/share/qt4/mkspecs/common/gcc-base-unix.conf \
/usr/share/qt4/mkspecs/common/g++-base.conf \
/usr/share/qt4/mkspecs/common/g++-unix.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/shared.prf \
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf
$(QMAKE) -o Makefile conturi.pro
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/common/gcc-base.conf:
/usr/share/qt4/mkspecs/common/gcc-base-unix.conf:
/usr/share/qt4/mkspecs/common/g++-base.conf:
/usr/share/qt4/mkspecs/common/g++-unix.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/release.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/shared.prf:
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
qmake: qmake_all FORCE
@$(QMAKE) -o Makefile conturi.pro

qmake_all: FORCE

make_default: FORCE
make_first: FORCE
all: FORCE
clean: FORCE
distclean: FORCE
-$(DEL_FILE) Makefile
install_subtargets: FORCE
uninstall_subtargets: FORCE

check:

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all
install: install_subtargets FORCE

uninstall: uninstall_subtargets FORCE

FORCE:



Here is conturi.pro:



#-------------------------------------------------
#
# Project created by QtCreator 2014-05-11T22:21:26
#
#-------------------------------------------------

QT += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

#QMAKE_LFLAGS += /INCREMENTAL:NO

TARGET = conturi
TEMPLATE = subdirs

SOURCES += src/sources/main.cpp\
src/sources/mainwindow.cpp

HEADERS += src/headers/mainwindow.h

FORMS += src/forms/mainwindow.ui

RC_FILE = src/resources/conturi.rc