ich habe ein Verstaendnisproblem mit obigen Funktionen. Bisher habe ich wenn jemand im Menu "Quit" aufgerufen hat folgenden Code gehabt:
Code: Alles auswählen
connect(actionQuit,SIGNAL (triggered()), this, SLOT(slotClose()));
void my_class::slotClose(){
close();
}
Code: Alles auswählen
bool QWidget::close () [slot]
Closes this widget. Returns true if the widget was closed; otherwise returns false.
}
Zu exit() lese ich:
Code: Alles auswählen
void QCoreApplication::exit ( int returnCode = 0 ) [static]
Tells the application to exit with a return code.
Dann gibt es noch das quit(),
Code: Alles auswählen
void QCoreApplication::quit () [static slot]
Tells the application to exit with return code 0 (success). Equivalent to calling QCoreApplication::exit(0).
So nun zu den Fragen:
1. Ist es okay close() zum beenden zu benutzen, oder "fehlt" dann was und es sollte nur zum Fenster schliessen benutzt werden?
2. exit() hat lt. obiger Doku doch als Default 0, so lese ich dass zumindest. Wenn ich anstatt exit(0) aber nur exit() aufrufe bekomme ich "too few arguments" beim make. Was uebersehe ich hier?
3. Warum funktioniert exit() ohne das QCoreApplication und quit() nur mit?
4. Ich koennte das close() auch direkt in den connect string schreiben. Waere das ehr ein bessere oder ein schlechterer Stil?
Danke,
J.