Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Calling functions from one class to another
petergeng last edited by
I am working in one class (named 'ModelBrowserTree') and want to pass some information to another class (named 'Dialog')that i've created. However, in the function call it seems that only objects are allowed in this passing process... why this is? is this necessary? how can i bypass this?
the function call while in a member function of ModelBrowserTree i have is:
ModelChangedInfo is a member function of Dialog, and docAnno is a string........
QString ModelChangedInfo(QString str)
andre last edited by
This is really, really basic C++, that has nothing to do with Qt. Please pick up any basic C++ book to get started.
lgeyer last edited by
[quote author="petergeng" date="1319129803"]However, in the function call it seems that only objects are allowed in this passing process... why this is? is this necessary? how can i bypass this?[/quote]
Well - it isn't. The call fails in your case because ModelChangedInfo() is a non-static method. So you either make it a static method (which is what you most probably do not want) or you call ModelChangedInfo() on an object of Dialog.
If you do not know what I am talking about you should seriously consider what Andre said. Qt absolutely requires you to have at least a basic understanding of C++. If there are any specific (and Qt-related) questions feel free to come back here.