[SOLVED] GUI with arguments
-
they are received in the main.cpp file of all Qt projects. What you need is to retrieve the arguments in the "main" and send it to your "mainwindow" class by the constructor or by a public function.
-
[quote author="l3e0wulf" date="1359012305"]There a way Qt Gui receive an application parameters?[/quote]"Accessing Command Line Arguments":http://qt-project.org/doc/qt-5.0/qtcore/qcoreapplication.html#accessing-command-line-arguments
[quote author="l3e0wulf" date="1359012305"]And how to put predefined parameters in Qt Creator to build the application?[/quote]"Specifying Run Settings for Desktop Device Types":http://qt-project.org/doc/qtcreator-2.6/creator-run-settings.html#specifying-run-settings-for-desktop-device-types
-
There is no difference for command line arguments between GUI and console application in Qt. They are always available through qApp->arguments().
In Qt Creator you can define your custom arguments in Project settings.-Looks like i was to slow :)-
-
Thanks solved!
mainwindow.h:
@explicit MainWindow(QStringList, QWidget *parent = 0);@mainwindow.cpp:
@MainWindow::MainWindow(QStringList arguments, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this); qDebug() << arguments;
}@
main.cpp:
@MainWindow window(a.arguments());@ -
-Please add "[SOLVED]" prefix to the topic subject. Thanks!-