Are you sure your file contains the correct include directive ( #include <QVariant> in that case)
For less troubles with includes I suggest you do :
//everywhere
#include <QtCore>
//if gui used
#include <QtGui>
//if SQL used
#include <QtSql>
//and so on...
//everywhere
#include <QtCore>
//if gui used
#include <QtGui>
//if SQL used
#include <QtSql>
//and so on...
To copy to clipboard, switch view to plain text mode
oh, btw: i wanted to check if db isn't by some chance out of scope. it's been some time that i learned some c and i am now just trying to remember. For the last years i have only been scripting in php, so i tried:
if (!db)
if (db == false)
but nothing works. the last line gives me a compilererror of
no match for 'operator==' in 'db == false'
what is that suppossed to mean?
It just means that Qt doesn't offer any overload of operator '==' for QSqlDatabase class. AFAIK a database can never be out of scope by itslef so your test is quite meaningless. 'if ( !db ) can be usefull to detect wether a pointer is initialized or not but your 'db' variable doesn't seem to be a pointer...
Bookmarks