PDA

View Full Version : How to get the *.h and *.cpp from *.ui generated by QtDesigner?



luffy27
16th November 2006, 17:05
I developed a form from QtDesigner 3.3 and generated the multiclip.ui. But after I compile the project with make there is neither multiclip.h and multiclip.cpp.

Here is the process of compile:
[root@localhost Multiclip]# ls
main.cpp multiclip.ui multiclip.ui.h
multiclip.pro multiclip.ui~ multiclip.ui.h~
[root@localhost Multiclip]# qmake
[root@localhost Multiclip]# ls
main.cpp multiclip.pro multiclip.ui~ multiclip.ui.h~
Makefile multiclip.ui multiclip.ui.h
[root@localhost Multiclip]# make
g++ -o multiclip .obj/main.o .obj/multiclip.o .obj/moc_multiclip.o -L/usr/lib/qt-3.3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
[root@localhost Multiclip]# ls
main.cpp multiclip multiclip.ui multiclip.ui.h
Makefile multiclip.pro multiclip.ui~ multiclip.ui.h~

Is it needed the uic tool to transform *.ui to *.h and *.cpp files?
And what is the purpose to get the *.h and *.cpp files from the *.ui?
Thanks.

wysota
16th November 2006, 17:43
1. Don't develop as root :)
2. Don't do anything that is not system maintanance as root
3. What does your project (.pro) file contain? Does it have a FORMS += multiclip.ui entry?

luffy27
23rd November 2006, 02:26
Yes it does.
I can only generate my .h and .cpp from .ui by using uic tool.
But the executable file must need the .h and .cpp files and where are they?I can't find them after i compile the project.

wysota
23rd November 2006, 07:04
Show the contents of your project file please.

sunil.thaha
23rd November 2006, 07:33
Can you post your .pro file contents

luffy27
23rd November 2006, 12:39
Here is the .pro file:
TEMPLATE = app
LANGUAGE = C++

CONFIG += qt warn_on release

SOURCES += main.cpp

FORMS = conversionform.ui

unix {
UI_DIR = .ui
MOC_DIR = .moc
OBJECTS_DIR = .obj
}

And here are the files I have already got after compiling:
conversionform.ui conversionform.ui.h main.cpp metric
conversionform.ui~ conversionform.ui.h~ Makefile metric.pro

Here is the Makefile:
################################################## ###########################
# Makefile for building: metric
# Generated by qmake (1.07a) (Qt 3.3.3) on: Thu Nov 23 17:46:31 2006
# Project: metric.pro
# Template: app
# Command: $(QMAKE) -o Makefile metric.pro
################################################## ###########################

####### Compiler, tools and options

CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -Wall -W -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT
CXXFLAGS = -pipe -Wall -W -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I/usr/lib/qt-3.3/mkspecs/default -I. -I$(QTDIR)/include -I.ui/ -I. -I.moc/
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE= $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p

####### Output directory

OBJECTS_DIR = .obj/

####### Files

HEADERS =
SOURCES = main.cpp
OBJECTS = .obj/main.o \
.obj/conversionform.o
FORMS = conversionform.ui
UICDECLS = .ui/conversionform.h
UICIMPLS = .ui/conversionform.cpp
SRCMOC = .moc/moc_conversionform.cpp
OBJMOC = .obj/moc_conversionform.o
DIST = metric.pro
QMAKE_TARGET = metric
DESTDIR =
TARGET = metric

first: all
####### Implicit rules

.SUFFIXES: .c .o .cpp .cc .cxx .C

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules

all: Makefile $(TARGET)

$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)

mocables: $(SRCMOC)
uicables: $(UICDECLS) $(UICIMPLS)

$(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) )

Makefile: metric.pro /usr/lib/qt-3.3/mkspecs/default/qmake.conf /usr/lib/qt-3.3/lib/libqt-mt.prl
$(QMAKE) -o Makefile metric.pro
qmake:
@$(QMAKE) -o Makefile metric.pro

dist:
@mkdir -p .obj/metric && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/metric/ && $(COPY_FILE) --parents conversionform.ui.h .obj/metric/ && ( cd `dirname .obj/metric` && $(TAR) metric.tar metric && $(GZIP) metric.tar ) && $(MOVE) `dirname .obj/metric`/metric.tar.gz . && $(DEL_FILE) -r .obj/metric

mocclean:
-$(DEL_FILE) $(OBJMOC)
-$(DEL_FILE) $(SRCMOC)

uiclean:
-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)

yaccclean:
lexclean:
clean: mocclean uiclean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core


####### Sub-libraries

distclean: clean
-$(DEL_FILE) $(TARGET) $(TARGET)


FORCE:

####### Compile

.obj/main.o: main.cpp .ui/conversionform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/main.o main.cpp

.ui/conversionform.h: conversionform.ui
$(UIC) conversionform.ui -o .ui/conversionform.h

.ui/conversionform.cpp: .ui/conversionform.h conversionform.ui
$(UIC) conversionform.ui -i conversionform.h -o .ui/conversionform.cpp

.obj/conversionform.o: .ui/conversionform.cpp conversionform.ui.h \
.ui/conversionform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/conversionform.o .ui/conversionform.cpp

.obj/moc_conversionform.o: .moc/moc_conversionform.cpp .ui/conversionform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_conversionform.o .moc/moc_conversionform.cpp

.moc/moc_conversionform.cpp: $(MOC) .ui/conversionform.h
$(MOC) .ui/conversionform.h -o .moc/moc_conversionform.cpp

####### Install

install:

uninstall:

sunil.thaha
23rd November 2006, 14:31
unix {
UI_DIR = .ui
MOC_DIR = .moc
OBJECTS_DIR = .obj
}
Here it is
[]

wysota
23rd November 2006, 16:35
Come on guys, normal sized fonts are just as pretty as those huge ones...

luffy27
24th November 2006, 11:14
unix {
UI_DIR = .ui
MOC_DIR = .moc
OBJECTS_DIR = .obj
}

Here it is
[]

First there is no .ui , .moc and .obj in my directory after compiling.
And then I have seen you wrote that "Here it is []", then I tried to change the {} to []. But after the revision, when I type qmake -o Makefile metric.pro, there occurred an error which stemed from the [].

jacek
24th November 2006, 11:30
First there is no .ui , .moc and .obj in my directory after compiling.
Can you post the result of "ls -la" command?

arnaiz
27th November 2006, 20:37
First there is no .ui , .moc and .obj in my directory after compiling.
.

Your makefile uses .ui, .obj, and .moc directories to compile. So I'm almost sure there is a .ui directory with the .h and .cpp files.

Use "ls -a" to see hidden directories, or just "ls .ui".

Bye
Uppps!!
Sorry, I didn't see Jacek answer...