PDA

View Full Version : QTable gives error when put on a dialog??



darpan
31st July 2006, 09:55
Hi,
I am trying to make a new project using QT 3.3.5 Designer. My requirement is to take
a table on a dialog. But when i take a table widget on a dialog and I do nothing with
table and compile the project it gives errors


Following are the errors at compile time:

c++ -c -pipe -Wall -W -Os -DQT_NO_DEBUG -DQT_SHARED -
DQT_ACCESSIBILITY_SUPPORT -DQT_TABLET_SUPPORT -I/Developer/qt/mkspecs/
default -I. -I. -I/Developer/qt/include -o form1.o form1.cpp
form1.cpp: In constructor `Form1::Form1(QWidget*, const char*, bool, unsigned
int)':
form1.cpp:32: error: invalid use of undefined type `struct QTable'
form1.h:20: error: forward declaration of `struct QTable'
form1.cpp:33: error: `numCols' undeclared (first use this function)
form1.cpp:33: error: (Each undeclared identifier is reported only once for each
function it appears in.)
form1.cpp:33: error: `setNumCols' undeclared (first use this function)
form1.cpp:34: error: `horizontalHeader' undeclared (first use this function)
form1.cpp:37: error: `setGeometry' undeclared (first use this function)
form1.cpp:38: error: `setNumRows' undeclared (first use this function)
form1.cpp: In member function `virtual void Form1::languageChange()':
form1.cpp:60: error: `horizontalHeader' undeclared (first use this function)
make: *** [form1.o] Error 1

Same errors get when i make a new project on QT 3.3.6 and take a dailog containg a
table on it.

When i delete the table and compile the project it compiles error free.


Please help me by giving example of table. What should i have to do?


Thanks and Regards

jpn
31st July 2006, 10:07
#include <qtable.h>

darpan
2nd August 2006, 12:50
I had done nothing in my project , I only take a qtable widget on a dialog.
I am attaching my project , Plz check table.zip.


Thanks and Regards

arnaiz
7th August 2006, 19:57
Hi, darpan

I think I know what's going on. In your project there are two versions of form1.h.

One is in dir .ui, the other in the main directory. The one in the .ui directory do not have the line:
#include <qtable.h>

but file form1.h in main directory, include's qtable.h.

Maybe the way you are compiling your projet is using the one without the <qtable.h> include. I can't check this because i'm ussing Qt 3.3.4, and this version generates files with qtable.h included automatically.

But if I modify all source files that include qtable.h and run make without running qmake, I get an error similar to the one you get:

g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o form1.o form1.cpp
form1.cpp: In constructor `Form1::Form1(QWidget*, const char*, bool, unsigned int)':
form1.cpp:33: error: invalid use of undefined type `struct QTable'
form1.h:21: error: forward declaration of `struct QTable'
form1.cpp:34: error: `setGeometry' undeclared (first use this function)
form1.cpp:34: error: (Each undeclared identifier is reported only once for each function it appears in.)
form1.cpp:35: error: `setNumRows' undeclared (first use this function)
form1.cpp:36: error: `setNumCols' undeclared (first use this function)
make: *** [form1.o] Error 1

I hope this can be of some help.