Results 1 to 11 of 11

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

  1. #1
    Join Date
    Nov 2006
    Posts
    58
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Question How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    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?

  3. #3
    Join Date
    Nov 2006
    Posts
    58
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    Show the contents of your project file please.

  5. #5
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    Can you post your .pro file contents
    We can't solve problems by using the same kind of thinking we used when we created them

  6. #6
    Join Date
    Nov 2006
    Posts
    58
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    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:

  7. #7
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    unix {
    UI_DIR = .ui
    MOC_DIR = .moc
    OBJECTS_DIR = .obj
    }
    Here it is
    []
    We can't solve problems by using the same kind of thinking we used when we created them

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    Come on guys, normal sized fonts are just as pretty as those huge ones...

  9. #9
    Join Date
    Nov 2006
    Posts
    58
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    Quote Originally Posted by sunil.thaha View Post
    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 [].

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    Quote Originally Posted by luffy27 View Post
    First there is no .ui , .moc and .obj in my directory after compiling.
    Can you post the result of "ls -la" command?

  11. #11
    Join Date
    Mar 2006
    Location
    Mexico City
    Posts
    31
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get the *.h and *.cpp from *.ui generated by QtDesigner?

    Quote Originally Posted by luffy27 View Post
    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...
    Last edited by arnaiz; 27th November 2006 at 20:42. Reason: Nothing new inside

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.