BashTEMPLATE = appTARGET =DEPENDPATH += .INCLUDEPATH += . CONFIG += warn_on release # InputHEADERS += application.hSOURCES += main.cpp application.cpp #QMAKE_CXXFLAGS += -DREPRODUCE
C++ (Qt)#ifndef G_APPLICATION_H#define G_APPLICATION_H #ifdef REPRODUCE #include <QApplication> class Application : public QApplication{ public: Application(int, char **);}; #endif #endif
C++ (Qt)#ifdef REPRODUCE#include "application.h" Application::Application(int argc, char **argv) : QApplication(argc, argv){}#endif
C++ (Qt)#include <QApplication>#include <QVariant>#include <QDebug> #include "application.h" #ifndef REPRODUCEclass Application : public QApplication{ public: Application(int argc, char **argv) : QApplication(argc, argv) {}};#endif int main(int argc, char *argv[]){ Application app(argc, argv); app.setProperty("hello", "hello"); return app.exec();}
C++ (Qt) app.setProperty("hello", "hello"); int ac = app.argc(); printf("ARGC: %d\n", ac);
C++ (Qt)int main(int argc, char *argv[]){ Application app(argc, argv); app.setProperty("hello", "hello"); QStringList list = app.arguments(); qDebug() << list.size(); for (int i = 0; i < list.size(); ++i) qDebug() << list.at(i); return app.exec();}
C++ (Qt)#include <QApplication>#include <QStringList>#include <QVariant>#include <QDebug> #include "application.h" #ifndef REPRODUCEclass Application : public QApplication{ public: Application(int argc, char **argv) : QApplication(argc, argv) {}};#endif int main(int argc, char *argv[]){ Application app(argc, argv); app.setProperty("hello", "hello"); QStringList list = app.arguments(); qDebug() << list.size(); for (int i = 0; i < list.size(); ++i) qDebug() << list.at(i); return app.exec();}
C++ (Qt)Application(int &argc, char **argv){}