How can I edit a .ui.h file?
-
I'm a beginner in Qt and got a Qt project.
There is a mainform.ui file with a mainform.ui.h
In the top of mainform.ui.h is this text written:
... If you want to add, delete, or rename functions or slots, use Qt Designer to update this file...I can open the mainform.ui.h file but I wana write my classes in it! How and where?
-
Hi,
It's not working like this, like the text says you have to modify mainform.ui using Qt Designer. Have a look at designer's documentation and related examples to see what you can do
-
.ui (XML) format are converted during build process into C++ header files by UIC (User Interface Compiler). As Qt documentation says in the UIC documentation: The UIC reads an XML format user interface definition (.ui) file as generated by Qt Designer and creates a corresponding C++ header file.
If your form filename is myform.ui, uic generates ui_myform.h. No matter what name of your class (objectName) is.
It's actually a C++ definition of your dialog. To modify this header file makes no sense because it is recreated during the build process and any changes are lost.
read this link
http://sector.ynet.sk/qt4-tutorial/my-first-qt-gui-application.html -
I'm all mixed up!
I went through the top sample , wrote the myqtapp.h file and after compiling I got many compiler errors and my myqtapp.h file is empty!!
Why we write one time .h file and next time we shall not write in it!
There is a zip file, it's the same compiler error with it. But my problem is, what is the logic here? Why is the .h after compiling empty and how can I modify this empty file??? -
What error are you getting ? On what OS ? Which Qt version ?
I've tested the zip sample and it works.
-
I found a sample in Qt documentation which works. I know the top sample is for windows . I have Ubuntu 10.04 and Qt Creator 1.3.1.
The project is written in Qt3 and I have to update it in Qt4. I did this with qt3to4 but there are many compiler errors!
I red in the forum here that is better to write it again in Qt4. But this is also not easy! I designed the Form, but that is all what now works!These are the compiler errors in the project after using command make:
g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:26: error: ‘MainForm’ was not declared in this scope
main.cpp:26: error: expected ‘;’ before ‘w’
main.cpp:28: error: ‘w’ was not declared in this scope
make: *** [main.o] error 1this is the main.cpp:
#include <iostream>
using namespace std;
#include <string.h> /* String function definitions /
#include <unistd.h> / UNIX standard function definitions /
#include <fcntl.h> / File control definitions /
#include <errno.h> / Error number definitions /
#include <termios.h> / POSIX terminal control definitions */
#include <qnamespace.h>
#include <qapplication.h>
#include "mainform.h"int main( int argc, char ** argv )
{
char filename[1000];
strcpy(filename, argv[0]);
QApplication a( argc, argv);
MainForm w;
sleep(5);
w.showFullScreen();a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); w.FormStart(&filename[0]); return a.exec();
}
MainForm exists in mainform.ui.h. But the UIC cannot see it!