Hi,

I want to make a little program to make archives.
I'm currently at the stage that I have written the GUI and I want to display the name of the file that has been passed as an argument in a QLineEdit field so that it can be changed.
I tried to use argument() and also argc and argv, both attempts were unsuccessful.
Maybe you can show me what needs to be done to show the name of a file?
(or point me to a tutorial with a good explanation. Because the reason that I ask this question is that I couldn't find a good example)
Example:
Qt Code:
  1. #include <QtGui/QApplication>
  2. #include "verticalbox.h"
  3.  
  4. int main(int argc, char *argv[])
  5. { QApplication app(argc, argv);
  6. VerticalBox window;
  7. window.show();
  8. return app.exec();}
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #ifndef VERTICALBOX_H
  2. #define VERTICALBOX_H
  3. #include <QWidget>
  4.  
  5. class VerticalBox : public QWidget
  6. { public:
  7. VerticalBox(QWidget *parent = 0);};
  8.  
  9. #endif
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include <QApplication>
  2. #include "verticalbox.h"
  3.  
  4. #include <QVBoxLayout>
  5. #include <QHBoxLayout>
  6. #include <QPushButton>
  7. #include <QLabel>
  8. #include <QLineEdit>
  9.  
  10. VerticalBox::VerticalBox(QWidget *parent) : QWidget(parent)
  11. {
  12. QVBoxLayout *vbox = new QVBoxLayout(this);
  13. QHBoxLayout *contentBox = new QHBoxLayout();
  14. QHBoxLayout *buttonBox = new QHBoxLayout();
  15.  
  16. //HBox contentBox containing the QLabel and QLineEdit:
  17. QLabel *name = new QLabel("Name: ", this);
  18. QLineEdit *name_in = new QLineEdit(this);
  19. //name_in->setText(/*the part where I want the name of the file in the arguments*/);
  20. contentBox->addWidget(name);
  21. contentBox->addWidget(name_in);
  22.  
  23. //HBox buttonBox with the ok and cancel buttons
  24. QPushButton *ok = new QPushButton("OK", this);
  25. QPushButton *cancel = new QPushButton("Cancel", this);
  26. connect(cancel, SIGNAL(clicked()), qApp, SLOT(quit()));
  27. buttonBox->addWidget(ok, 1, Qt::AlignRight);
  28. buttonBox->addWidget(cancel, 0, Qt::AlignRight);
  29.  
  30. //VBox vbox, which contains the two HBoxes:
  31. vbox->addLayout(contentBox);
  32. vbox->addLayout(buttonBox);
  33. }
To copy to clipboard, switch view to plain text mode 

Uploaded with ImageShack.us