How can I get instance of FileManager from QMainWindow in Qt Creator?
Hello all, I noticed that there's Core::FileManager *fileManager() const; public function in MainWindow.h and .cpp files. It returns instance of fileManager. But how do I get instance of main window?
PS. Core::ICore::instance()->mainWindow() returns instance of QMainWindow.
Re: How can I get instance of FileManager from QMainWindow in Qt Creator?
You ask two different questions:
Quote:
How can I get instance of FileManager from QMainWindow in Qt Creator?
Sorry, but I have no idea of what FileManager could be. Ask the code author.
Quote:
But how do I get instance of main window?
PS. Core::ICore::instance()->mainWindow() returns instance of QMainWindow.
Then try to qobject_cast this instance.
Quote:
Hello all, I noticed that there's Core::FileManager *fileManager() const; public function in MainWindow.h and .cpp files.
What files ? Is it some kind of your personal project ? If yes, then how should we know anything about it ?
Re: How can I get instance of FileManager from QMainWindow in Qt Creator?
It's a source of a Qt creator. I am making a plugin for Qt creator.
Re: How can I get instance of FileManager from QMainWindow in Qt Creator?
Ok, so have you tried to use qobject_cast on the QMainWindow instance ?
Re: How can I get instance of FileManager from QMainWindow in Qt Creator?
Quote:
Originally Posted by
mrsomeonee
It's a source of a Qt creator. I am making a plugin for Qt creator.
Why don't you post your questions in a proper sub-forum then?
Re: How can I get instance of FileManager from QMainWindow in Qt Creator?
The ICore interface defines a ICore::fileManager() accessor in exactly the same way it defines mainWindow():
Code:
FileManager *fm = ICore::instance()->fileManager();