Re: How to extend a class ?
I think the problem is because you forgot the semi-colon at the end of your class declaration.
Re: How to extend a class ?
Thanks for that notification but that doesn't solve the problem. In fact, I think the compiler would show it if it was gone to that line !
Conclusion... that is a little more difficult !
Re: How to extend a class ?
Quote:
Originally Posted by agent007se
Conclusion... that is a little more difficult !
How do you build your application? Do you use qmake?
Re: How to extend a class ?
Quote:
Originally Posted by jacek
How do you build your application? Do you use qmake?
I use a little tool called qt-prebuild which is fully functionnal because I already compiled other Qt based programs very well without difficulties so it must call qmake nicely to do that.
edit: of course that program run uic.exe, moc.exe and so on... all what's needed to compile.
Re: How to extend a class ?
Quote:
Originally Posted by agent007se
I already compiled other Qt based programs very well without difficulties so it must call qmake nicely to do that.
Are you sure that there are no other errors? Maybe your compiler can't find Qt headers?
Re: How to extend a class ?
Try putting this on line 18 of MOC'ed file.
Code:
typedef unsigned int uint
Then we might get other errors due to some Qt include related configuration.
Re: How to extend a class ?
Quote:
Originally Posted by bits
Try putting this on line 18 of MOC'ed file.
Code:
typedef unsigned int uint
Then we might get other errors due to some Qt include related configuration.
That wasn't the problem !
I solved the problem with deleting all "crap" files that weren't needed anymore and now it works BUT I have a new problem which fit nicely with the title of this topic so we can continue now :
here is the output :
Quote:
Linking executable: C:\test\app.exe
.objs\moc_qlistviewext.o:moc_qlistviewext.cpp:(.rd ata$_ZTV12QListViewExt[vtable for QListViewExt]+0x14): undefined reference to `QListViewExt::~QListViewExt()'
.objs\moc_qlistviewext.o:moc_qlistviewext.cpp:(.rd ata$_ZTV12QListViewExt[vtable for QListViewExt]+0x18): undefined reference to `QListViewExt::~QListViewExt()'
.objs\moc_qlistviewext.o:moc_qlistviewext.cpp:(.rd ata$_ZTV12QListViewExt[vtable for QListViewExt]+0x190): undefined reference to `non-virtual thunk to QListViewExt::~QListViewExt()'
.objs\moc_qlistviewext.o:moc_qlistviewext.cpp:(.rd ata$_ZTV12QListViewExt[vtable for QListViewExt]+0x194): undefined reference to `non-virtual thunk to QListViewExt::~QListViewExt()'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 10 seconds)
0 errors, 0 warnings
I think that the better thing to do is restarting a new and clean project file because I'll use a QTreeWidget which have the function I wanted so that I don't need to extend anything !
Thanks for trying to help me !
Oh, last thing, can you say me if there is a "default" structure of tree in QTreeView like in QTreeWidget ?
Re: How to extend a class ?
Quote:
Originally Posted by agent007se
undefined reference to `QListViewExt::~QListViewExt()'
Maybe you forgot to implement the destructor?
Re: How to extend a class ?
Quote:
Originally Posted by jacek
Maybe you forgot to implement the destructor?
Please, can you give me a minimal implementation of qlistviewext.cpp in regard of the qlistviewext.h ?
I have some difficulties to do that because I'm just beginning with "serious" things with Qt !!
I'll give you a thank just after that :D !!
Re: How to extend a class ?
Quote:
Originally Posted by agent007se
Please, can you give me a minimal implementation of qlistviewext.cpp in regard of the qlistviewext.h ?
Code:
QListViewExt
::QListViewExt( QWidget *parent,
const char *name
){
setObjectName( name );
}
QListViewExt::~QListViewExt()
{
// empty
}
Your constructor signature looks like if you were trying to use Qt3, not Qt4. Qt4 doesn't use name parameter in widget constructors.
Re: How to extend a class ?
Well, it work like a charm now :D.
- Removed the name because I was using an old howto !
- Added the desctructor
Thanks again ;) !