Hi, ich bneutze Qt 4 und muss mein MainWindow vorzeitig beenden. Leider klappt es bei mir nicht mit quit und exit. Hat jemand eine Idee wie das funktioniert? Ich hab da ein link gefunden, der Verfasser vom letzten Beitrag meint bei ihm klappt es auf seiner Art. Entweder hab ich seine Art falsch verstanden oder sie funktioniert auch nicht. klappt es bei euch?
http://lists.trolltech.com/qt-interest/ ... 00416.html
Programm in main beenden
Ich glaube das liegt nicht an mir, den es hatten schon mehrere dieses Problem. Deswegen probier ich jetzt es über einen Umweg zu machen. Aber irgendwie macht es nicht was ich will. Könntet ihr mal den Quellcode bitte angucken.
Code: Alles auswählen
/********************************************************************************
** Form generated from reading ui file 'untitled.ui'
**
** Created: Wed 13. Dec 08:09:43 2006
** by: Qt User Interface Compiler version 4.2.1
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_UNTITLED_H
#define UI_UNTITLED_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
#include <QtGui/QWidget>
#include <QObject>
class Ui_UpdateWindow : public QObject
{
Q_OBJECT
signals:
void updated();
public:
QWidget *centralwidget;
QLabel *label_2;
QLabel *label;
void finished()
{
updated();
}
void setupUi(QMainWindow *UpdateWindow)
{
UpdateWindow->setObjectName(QString::fromUtf8("UpdateWindow"));
QApplication::setStyle("plastique");
centralwidget = new QWidget(UpdateWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
label_2 = new QLabel(centralwidget);
label_2->setObjectName(QString::fromUtf8("label_2"));
label_2->setGeometry(QRect(70, 50, 81, 19));
QFont font;
font.setPointSize(12);
label_2->setFont(font);
label = new QLabel(centralwidget);
label->setObjectName(QString::fromUtf8("label"));
label->setGeometry(QRect(70, 20, 81, 21));
QFont font1;
font1.setPointSize(12);
font1.setBold(true);
font1.setWeight(75);
label->setFont(font1);
label->setMargin(0);
label->setIndent(-1);
UpdateWindow->setCentralWidget(centralwidget);
retranslateUi(UpdateWindow);
QSize size(216, 96);
size = size.expandedTo(UpdateWindow->minimumSizeHint());
UpdateWindow->resize(size);
UpdateWindow->setMinimumWidth(529);
UpdateWindow->setMinimumHeight(250);
UpdateWindow->setMaximumWidth(529);
UpdateWindow->setMaximumHeight(250);
QObject::connect(this, SIGNAL(updated()), UpdateWindow, SLOT(close()));
QMetaObject::connectSlotsByName(UpdateWindow);
} // setupUi
void retranslateUi(QMainWindow *UpdateWindow)
{
UpdateWindow->setWindowTitle(QApplication::translate("UpdateWindow", "Create Altiris Boot-ISO", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("UpdateWindow", "Please wait", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("UpdateWindow", "Updating!", 0, QApplication::UnicodeUTF8));
Q_UNUSED(UpdateWindow);
} // retranslateUi
};
namespace Ui {
class UpdateWindow: public Ui_UpdateWindow {};
} // namespace Ui
#endif // UI_UNTITLED_H
Code: Alles auswählen
#include <QApplication>
#include <QtGui>
#include <QtCore>
#include "ui_untitled.h"
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow *window = new QMainWindow();
Ui::UpdateWindow ui;
ui.setupUi(window);
ui.finished();
window->show();
return app.exec();
//app.exit(0);
}