Don
Don

Reputation:

running a QT program as window and as command line

I am using QT under windows and have an application where I want to use the arguments to determine if this comes from a bat file and so all data is in the arguments, or if it should pop us the menu window to allow the user to input the data.

Any examples of how to do this?

Thanks

Upvotes: 1

Views: 517

Answers (2)

Kunal
Kunal

Reputation: 3535

I think you want to check if your application is lauched with command line argument or not. If not then display some dialogbox to get input.

main function of c++ program has two argument, first is the number of arguments and other is an argument array. you can use these two parameters to decide it you got the command line parameter the from user or not.

Upvotes: 1

Martin Beckett
Martin Beckett

Reputation: 96119

Simply don't create or show the QMainWindow

There are a few extra complexities about event loops and signals/slots. There is also an issue on Windows that whether the create a console or not is a linker not a runtime option.

See How do I create a simple Qt console application in C++?

Upvotes: 1

Related Questions