Mat
01-10-2005, 12:14
Hallo
habe große Ansatzschwierigkeiten mit C++/Qt. Alles was ich will ist einfach bloß aus der Mainklasse eine andere Klasse aufrufen die mir ein MainWindow erstellt und da zum Beispiel einen Button darstellen lassen in dem fenster. Es soll ja mal ne Oberfläche werden...Bloß komme ich absolut nicht auf einen grünen Zweig. Ich bitte euch um Nachsicht...wenn ich erstmal in Fahrt komme legt sich das .......nur schaffe ich nicht mal das :(
warum funktioniert folgendes Beispiel bei mir nicht???
Projektart unter kdevelop: C++ -> Qmake -> Application
meine Klasse main:
#include <qapplication.h>
#include "runsimulation.h"
int main( int argc, char ** argv ) {
QApplication app( argc, argv );
RUNSIMULATION mw;
app.setMainWidget(&mw);
mw.show();
return app.exec();
}
das header file:
#ifndef RUNSIMULATION_H
#define RUNSIMULATION_H
#include <qmainwindow.h>
class QPushButton;
class RUNSIMULATION: public QMainWindow
{
Q_OBJECT
public:
RUNSIMULATION(QWidget *parent = 0, const char *name = 0);
//runsimulation();
// ~runSimulation();
void testemal();
private:
QPushButton *hello;
};
#endif
und zuletzt meine KLasse runsimulation die aufgerufen wird:
#include "runsimulation.h"
#include <qpushbutton.h>
#include <iostream.h>
RUNSIMULATION::RUNSIMULATION(QWidget *parent, const char *name): QMainWindow(parent,name)
{
testemal();
}
void RUNSIMULATION::testemal()
{
cout << "dies ist ein test" << endl;
hello = new QPushButton("jojoojoj", this);
//hello("Hello world!");
hello->resize(100, 30);
//hello->setMainWidget(this);
hello->show();
}
Danke euch für jede Mühe und hilfe
habe große Ansatzschwierigkeiten mit C++/Qt. Alles was ich will ist einfach bloß aus der Mainklasse eine andere Klasse aufrufen die mir ein MainWindow erstellt und da zum Beispiel einen Button darstellen lassen in dem fenster. Es soll ja mal ne Oberfläche werden...Bloß komme ich absolut nicht auf einen grünen Zweig. Ich bitte euch um Nachsicht...wenn ich erstmal in Fahrt komme legt sich das .......nur schaffe ich nicht mal das :(
warum funktioniert folgendes Beispiel bei mir nicht???
Projektart unter kdevelop: C++ -> Qmake -> Application
meine Klasse main:
#include <qapplication.h>
#include "runsimulation.h"
int main( int argc, char ** argv ) {
QApplication app( argc, argv );
RUNSIMULATION mw;
app.setMainWidget(&mw);
mw.show();
return app.exec();
}
das header file:
#ifndef RUNSIMULATION_H
#define RUNSIMULATION_H
#include <qmainwindow.h>
class QPushButton;
class RUNSIMULATION: public QMainWindow
{
Q_OBJECT
public:
RUNSIMULATION(QWidget *parent = 0, const char *name = 0);
//runsimulation();
// ~runSimulation();
void testemal();
private:
QPushButton *hello;
};
#endif
und zuletzt meine KLasse runsimulation die aufgerufen wird:
#include "runsimulation.h"
#include <qpushbutton.h>
#include <iostream.h>
RUNSIMULATION::RUNSIMULATION(QWidget *parent, const char *name): QMainWindow(parent,name)
{
testemal();
}
void RUNSIMULATION::testemal()
{
cout << "dies ist ein test" << endl;
hello = new QPushButton("jojoojoj", this);
//hello("Hello world!");
hello->resize(100, 30);
//hello->setMainWidget(this);
hello->show();
}
Danke euch für jede Mühe und hilfe