Creating the .h and putting the class declaration
class myTextEdit : public QTextEdit
{
Q_OBJECT
public:
myTextEdit(QWidget *parent=0, const char *name=0);
int count;
public slots:
void append(QString line);
void putLine(void);
};
caused syntax errors when making, but adding
#include <qtextedit.h>
at the beginning of the .h file stopped that and lo and behold my app
ran like I expected.
I don't understand the need for including the qtextedit.h file. In
main.cpp it is included AHEAD of the main.h include. Shouldn't that
have satisfied main.h's need for qtextedit.h? Or is it needed that
specific way for the moc generation?
Anyway, I got it to build and run and learned how.
Thanks to ALL who responded to this newbie.
tj
Paul Ruetz wrote:
I assume you have only one source file, say 'main.cpp'.
When you define signals or slots without having a header file, AFAIK
you have to do two steps manually, as they are:
1. Call the 'moc' manually:
moc main.cpp > moc_main.cpp
2. Include the 'moc_main.cpp' at the end of your 'main.cpp':
#include "moc_main.cpp"
To avoid these steps, always use header files when using signals/slots.
Hope this helps,
Paul
tj wrote:
--
List archive and information: http://lists.trolltech.com/qt-interest/