tokstolle
23rd March 2009, 14:52
Hello out there,
I have so troubble building a small app. My main.cpp has this easy structur:
#include "qtexplorer.h"
#include <QtGui>
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QtExplorer w = new QtExplorer;
w.show();
return a.exec();
}
my QtExplorer.h looks like this:
#ifndef QTEXPLORER_H
#define QTEXPLORER_H
#include <QWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include "ui_qtexplorer.h"
class QtExplorer : public QWidget
{
Q_OBJECT
public:
QtExplorer(QWidget *parent = 0);
~QtExplorer();
private:
Ui::QtExplorerClass ui;
long req_id;
private slots:
int ReadRegister();
int WriteRegister();
int ReadMem();
int WriteMem();
};
#endif // QTEXPLORER_H
So, what is my problem? I cannot build this easy code because there is an error at the first curly brace in the qtexplorer.h (this comes of the eclipse integration plugin) which says: "within this context".
After that brace comes the macro Q_OBJECT. Without this macro I cannot define slots. But what can I do to clear this error?
Thank you in advance..
Sincerely Tok
I have so troubble building a small app. My main.cpp has this easy structur:
#include "qtexplorer.h"
#include <QtGui>
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QtExplorer w = new QtExplorer;
w.show();
return a.exec();
}
my QtExplorer.h looks like this:
#ifndef QTEXPLORER_H
#define QTEXPLORER_H
#include <QWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include "ui_qtexplorer.h"
class QtExplorer : public QWidget
{
Q_OBJECT
public:
QtExplorer(QWidget *parent = 0);
~QtExplorer();
private:
Ui::QtExplorerClass ui;
long req_id;
private slots:
int ReadRegister();
int WriteRegister();
int ReadMem();
int WriteMem();
};
#endif // QTEXPLORER_H
So, what is my problem? I cannot build this easy code because there is an error at the first curly brace in the qtexplorer.h (this comes of the eclipse integration plugin) which says: "within this context".
After that brace comes the macro Q_OBJECT. Without this macro I cannot define slots. But what can I do to clear this error?
Thank you in advance..
Sincerely Tok