Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Retriving "About Qt" text sample code - REPOST
AnneRanch last edited by
Here is a basic top down description:
starting at "MDI" example
QMenu -> add main menu item into "menu bar"
use QAction to implement "pull-down" menu
use addAction - one of many overloads - to show local info "about xx"
QAction *run_test = testMenu->addAction
(tr("&Run test submenu - local about "), this, &MainWindow::about);
run locally defined function TOK
use addAction - one many overloads - to show remote "About Qt" info " the access to "About Qt" application is gained by specifying "qApp" pointer using #define
#define qApp (static_cast<QApplication *>(QApplication::instance()))
and implementing another "addAction"
helpMenu->addAction(tr("About &Qt "),
qApp , &QApplication::aboutQt);
Here is my specific problem I cannot resolve:
- The "MDI" example application is my main project in SUBDIRS scheme.
- The 'btscanner" example application is one of the subprojects.
- They both build / run as independent projects.
- The main "MDI" projects builds / runs as the SUBDIRS" scheme.
- "MDI" project has access / runs "About Qt" project.
HOW to I instruct "MDI" to access/ run "btscanner" project - using QMenu (QAction) ?
Since it works with "About Qt" it should work with other QApplication, but I have not found the way to refer from "MDI" to "btscanner" .
You are mixing two very different things.
aboutQt is a slot of the QApplication class.
btscanner and "MDI" are two different executables. You can't connect them like you connect a signal to a slot.
If you would like to execute btscanner from "MDI", you should consider using the QProcess class.
JonB last edited by
Or, refactor your btscanner so that it exposes its functionality through some
QWodget-derived class, without a main program. Then you can "load" it into an MDI subwindow.
AnneRanch last edited by
Thanks, what you are all indirectly saying - there is no particular advantage to use SUBDIRS to manage programs. Again SUBDIRS is OK to manage program ( singular) and its dependent libraries. Library as in pre-compiled code .
Which again is nothing special - "plain" C/C++ (GCC) also manages project / libraries relations .
Adding another layer - such qMake(s) with additional options ....
I have used plain C/C++ IDE to add "process" , the main reason I switched to to Qt was GUI and "events" . I'll give QProcess a go.
nagesh last edited by
@AnneRanch If you want to invoke the already created executable then use QProcess as suggested by others.
If you want to have greater control of "btscanner" application and it's instance creation in mdi, then modify the btscanner project as library project and include it as library in mdi project.
JonB last edited by JonB
If you run it as a sub-process, be aware that there will probably be nothing to put/show from your btscanner in an MDI subwindow. Unless it writes some text to stdout, which you would like to capture and display as text in a window.
Again: you are mixing different concepts.
The SUBDIRS project template is a project management tool. You can build several libraries and executables through it.
Then, how you handle these multiple executables in the end is a different problem unrelated to the project management part.