syntax error : identifier 'QSqlRelationalDelegate'
Hi,
For some reason, i cannot access the QSqlRelationalDelegate method, either in my code or with the sample code.
For example this code from the sample:
Code:
view->setModel(model);
i get a syntax error : identifier 'QSqlRelationalDelegate' error when compliing with VS2005.
Or with:
Code:
model->setTable(tableName);
model
->setRelation
(18,
QSqlRelation("Category",
"mCategoryID",
"mCategoryName"));
model->select();
m_pMusicTableView->setModel(model);
m_pMusicTableView->show();
All other sql functions seem to be working with no problem. (qsqldatabase, qsqlquery.. etc)
I have no clue what I have forgotten to include to get this to compile, any help appreciated.
Thanks,
Johnny
Re: syntax error : identifier 'QSqlRelationalDelegate'
Did you remember to #include <QSqlRelationalDelegate> ?
Re: syntax error : identifier 'QSqlRelationalDelegate'
I did.
What's killing me is that the examples have compiled when I compiled QT. I used vs2005 from the command line.
the funny tthing also is that if I take the complete sql example relationaltable.cpp and paste it into my files, it also fails with the same error.
Johnny
Re: syntax error : identifier 'QSqlRelationalDelegate'
Did you enable the SQL module for your project?
Re: syntax error : identifier 'QSqlRelationalDelegate'
Hi,
I did as i'm using the sql modules reguarly.
Johnny
Re: syntax error : identifier 'QSqlRelationalDelegate'
Try rewriting the messing code line manually - sometimes you might be pasting some weird whitespaces from an external source and the compiler will complain.
Re: syntax error : identifier 'QSqlRelationalDelegate'
I just had the same problem. Solution is:
Go to Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor
Add QT_GUI_LIB to Preprocessor Definitions.
(taken from http://truth2.wordpress.com/2010/09/...compile-error/)