Funktionsaufrufe [gelöst]
Verfasst: 18. April 2010 09:34
Hallo Forum,
ich wollte eine Funktion haben, die mir Spalten und Zeilen eines QGridLayout addiert.
in mainwindow.cpp:
int MainWindow::gridItems(QGridLayout &grid) {
return ( grid->rowCount() + grid->columnCount() );
}
dazu in der mainwindow.h als protected:
int gridItems(QGridLayout&);
der Aufruf erfolgt dann in mainwindow.cpp mit
qDebug() << gridItems(*myGridLayout);
gibt dann aber folgende Fehler:
mainwindow.cpp: In member function ‘int MainWindow::gridItems(QGridLayout&)’:
mainwindow.cpp:141: error: base operand of ‘->’ has non-pointer type ‘QGridLayout’
mainwindow.cpp:141: error: base operand of ‘->’ has non-pointer type ‘QGridLayout’
Könnt ihr mir erklären was ich da falsch mache?
Grüße
Roland
ich wollte eine Funktion haben, die mir Spalten und Zeilen eines QGridLayout addiert.
in mainwindow.cpp:
int MainWindow::gridItems(QGridLayout &grid) {
return ( grid->rowCount() + grid->columnCount() );
}
dazu in der mainwindow.h als protected:
int gridItems(QGridLayout&);
der Aufruf erfolgt dann in mainwindow.cpp mit
qDebug() << gridItems(*myGridLayout);
gibt dann aber folgende Fehler:
mainwindow.cpp: In member function ‘int MainWindow::gridItems(QGridLayout&)’:
mainwindow.cpp:141: error: base operand of ‘->’ has non-pointer type ‘QGridLayout’
mainwindow.cpp:141: error: base operand of ‘->’ has non-pointer type ‘QGridLayout’
Könnt ihr mir erklären was ich da falsch mache?
Grüße
Roland