File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 11#include " fhex.h"
22#include < QDebug>
33
4- Fhex::Fhex (QWidget *parent, QApplication *app)
4+ Fhex::Fhex (QWidget *parent, QApplication *app, QString filepath )
55 : QMainWindow(parent)
66{
77 this ->app = app;
@@ -212,6 +212,12 @@ Fhex::Fhex(QWidget *parent, QApplication *app)
212212 this ->statusBar .setText (" Fhex loaded" );
213213 this ->setCentralWidget (mainWidget);
214214
215+ // If a filepath was passed as argument, open it
216+ if (filepath != " " ) {
217+ this ->loadFile (filepath);
218+ this ->loadTables ();
219+ }
220+
215221}
216222
217223Fhex::~Fhex ()
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class Fhex : public QMainWindow
6565 Q_OBJECT
6666
6767public:
68- Fhex (QWidget *parent = nullptr , QApplication *app = nullptr );
68+ Fhex (QWidget *parent = nullptr , QApplication *app = nullptr , QString filepath = " " );
6969 ~Fhex ();
7070
7171private:
Original file line number Diff line number Diff line change 11#include " fhex.h"
2+ #include < QFile>
23#include < QApplication>
34
45int main (int argc, char *argv[])
56{
67 QApplication a (argc, argv);
7- Fhex w (nullptr , &a);
8+
9+ QString filepath = " " ;
10+ if ((argc > 1 ) && (QFile::exists (argv[1 ]))) {
11+ filepath = argv[1 ];
12+ }
13+ Fhex w (nullptr , &a, filepath);
814
915 w.show ();
1016
You can’t perform that action at this time.
0 commit comments