diff options
Diffstat (limited to 'qhexedit2/example/main.cpp')
-rw-r--r-- | qhexedit2/example/main.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qhexedit2/example/main.cpp b/qhexedit2/example/main.cpp new file mode 100644 index 0000000..c742e45 --- /dev/null +++ b/qhexedit2/example/main.cpp @@ -0,0 +1,30 @@ +#include <QApplication> +#include <QIcon> + +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(qhexedit); + QApplication app(argc, argv); + app.setApplicationName("QHexEdit"); + app.setOrganizationName("QHexEdit"); + app.setWindowIcon(QIcon(":images/qhexedit.ico")); + + // Identify locale and load translation if available + QString locale = QLocale::system().name(); + QTranslator translator; + translator.load(QString("qhexedit_") + locale); + app.installTranslator(&translator); + + QCommandLineParser parser; + parser.addPositionalArgument("file", "File to open"); + parser.addHelpOption(); + parser.process(app); + MainWindow *mainWin = new MainWindow; + if(!parser.positionalArguments().isEmpty()) + mainWin->loadFile(parser.positionalArguments().at(0)); + mainWin->show(); + + return app.exec(); +} |