While learning qt through the book : C++ GUI Programming with qt4, I've encounted this notation quite a few times : function()->function() or function().function().
Here is a common example from : http://doc.qt.nokia.com/4.6/qmainwindow.html (Creating Menus):
Qt Code:
void MainWindow::createMenus() { [B]fileMenu = menuBar()->addMenu(tr("&File"));[/B] fileMenu->addAction(newAct); fileMenu->addAction(openAct); fileMenu->addAction(saveAct);To copy to clipboard, switch view to plain text mode
Usually, in C++, I encounter Classes containing attributes and methods, but when I look at this notation, I see a function containing a function.
I could guess that in this example the menubar() function returns a pointer to a QMenuBar which contains a addMenu() function returning a QMenu, but where is the QMenuBar object coming from? It does not seem to be declared as an attribute of QMainWindow.
How am I supposed interpret this notation ?
Does this notation have a name, if yes what is it ?
Bookmarks