Unsolved Passing QSqlTableModel by value
-
Hello Guys,
How can pass a QSqlTableModel to a function by Value not by Reference?
ERROR!
QSqlTableModel model; foo(model); void foo(QSqlTableModel){ .... }
WORK BUT NOT GOOD FOR ME:
QSqlTableModel *model; foo(*model); void foo(QSqlTableModel){ .... }
I do not want to use pointer for passing a "model" as it will create a reference in heap like this:
[Edit: Added code tags ~kshegunov]
-
How can pass a QSqlTableModel to a function by Value not by Reference?
You can't.
QSqlTableModel
inheritsQObject
which means it can't be copied, thus it can't be passed by value.I do not want to use pointer for passing a "model" as it will create a reference in heap like this:
@Qt-Champions-2016Don't do that, please. I don't appreciate being summoned like this.
-
@Hasan-Vaez Why don't you want to use the heap? It is a good and useful thing.