basti1985
01-10-2007, 22:08
ich versuch mich gerade an QT und möchte ein neues fenster öffnen,
doch irgendwas stimmt hier was nicht
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <QtGui/QFont>
#include <QtGui/QWidgetAction>
int window(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget window;
window.resize(200, 100);
QWidget paint;
paint.resize(50, 50);
QLabel label("Hello World!", &window);
label.setGeometry(0, 0, 200, 50);
label.setAlignment(Qt::AlignCenter);
label.setFont(QFont("Arial", 20, QFont::Bold));
QPushButton button("Paint", &window);
button.setGeometry(10, 35, 180, 30);
QObject::connect(&button, SIGNAL(clicked()), &window, SLOT(createWidget(paint.show)));
QPushButton close("Close", &window);
close.setGeometry(10, 70, 180, 30);
QObject::connect(&button, SIGNAL(clicked()), &window, SLOT(close()));
window.show();
return app.exec();
}
int main(int argc, char *argv[])
{
window(argc, argv);
return 0;
}
doch irgendwas stimmt hier was nicht
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <QtGui/QFont>
#include <QtGui/QWidgetAction>
int window(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget window;
window.resize(200, 100);
QWidget paint;
paint.resize(50, 50);
QLabel label("Hello World!", &window);
label.setGeometry(0, 0, 200, 50);
label.setAlignment(Qt::AlignCenter);
label.setFont(QFont("Arial", 20, QFont::Bold));
QPushButton button("Paint", &window);
button.setGeometry(10, 35, 180, 30);
QObject::connect(&button, SIGNAL(clicked()), &window, SLOT(createWidget(paint.show)));
QPushButton close("Close", &window);
close.setGeometry(10, 70, 180, 30);
QObject::connect(&button, SIGNAL(clicked()), &window, SLOT(close()));
window.show();
return app.exec();
}
int main(int argc, char *argv[])
{
window(argc, argv);
return 0;
}