ach ja und nicht wundern das sind später nicht alle funktionen meines programms.
dient nur dazu um zu schauen ob ich mit dem connect button einen Com schnittstelle öffnen kann..
Vielleicht noch zur anmerktung also die Port_Interface.h und zugehörige cpp funktioniern auf jeden fall das hab ich in einer Konsolenanwendung schon getestet..
Meine Main:
Code: Alles auswählen
#include <qapplication.h>
#include <qpushbutton.h>
#include <QObject.h>
#include "moc_Port_Connect.h"
int main(int argc, char **argv)
{
QApplication app(argc,argv);
QWidget *widget = new QWidget();
widget->setGeometry(500,300,200,150);
QPushButton *button = new QPushButton("Connect",widget);
button->setGeometry(40,40,60,30);
Port_Connect *con = new Port_Connect(widget);
QObject::connect(button,SIGNAL(clicked()),con,SLOT(p_connect(void)));
QObject::connect(button,SIGNAL(clicked()),con,SLOT(p_connect()));
app.setActiveWindow(widget);
app.setStyle("plastique");
widget->show();
return app.exec();
Die Headerdatei Port_Connect.h:
Code: Alles auswählen
#ifndef PORT_CONNECT_H
#define PORT_CONNECT
#include <QObject.h>
#include "Port_Interface.h"
class Port_Connect: public QObject, public Port_Interface
{
Q_OBJECT
public:
Port_Connect(QWidget *parent) : QObject(parent){dwSetMask = EV_RXCHAR | EV_ERR;}
public slots:
void p_connect(void)
{
pi_open("COM2");
}
};
#endif
Die Headerdatei nach dem ich moc ausgeführt hab:
Code: Alles auswählen
/****************************************************************************
** Meta object code from reading C++ file 'Port_Connect.h'
**
** Created: Di 25. Jul 17:05:06 2006
** by: The Qt Meta Object Compiler version 58 (Qt 4.0.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "Port_Connect.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'Port_Connect.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 58
#error "This file was generated using the moc from 4.0.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
static const uint qt_meta_data_Port_Connect[] = {
// content:
1, // revision
0, // classname
0, 0, // classinfo
1, 10, // methods
0, 0, // properties
0, 0, // enums/sets
// slots: signature, parameters, type, tag, flags
14, 13, 13, 13, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_Port_Connect[] = {
"Port_Connect\0\0p_connect()\0"
};
const QMetaObject Port_Connect::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_Port_Connect,
qt_meta_data_Port_Connect, 0 }
};
const QMetaObject *Port_Connect::metaObject() const
{
return &staticMetaObject;
}
void *Port_Connect::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_Port_Connect))
return static_cast<void*>(const_cast<Port_Connect*>(this));
if (!strcmp(_clname, "Port_Interface"))
return static_cast<Port_Interface*>(const_cast<Port_Connect*>(this));
return QObject::qt_metacast(_clname);
}
int Port_Connect::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: p_connect(); break;
}
_id -= 1;
}
return _id;
}
vielleicht könnt ihr mir ja dabei helfen.. wäre echt nett hock hier nämlich schon seit guten 9 Stunden hab im Internet gesucht und gelesen und die komplette Trolltech documentation auswendig gelernt aber komm nicht wirklich weiter
zu guter letzt sollte ich vielleicht sagen das ich CodeBlocks als Entwicklungsplatform benutze..
gruß Dominik