Hi,

my testprogram works fine, I just wonder why I keep having a warning message.

I created a new GUI project, and gave one single more header file, which was "stolen" from the chatchedtable exapmle, but I modified the contents of the createconnection file in order to make connection to my own database. So now it looks like this:
Qt Code:
  1. #ifndef CONNECTION_H
  2. #define CONNECTION_H
  3.  
  4. #include <QtSql/QSqlDatabase>
  5.  
  6. static bool createConnection()
  7. {
  8. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
  9. db.setHostName("myhostname");
  10. db.setPort(5432);
  11. db.setDatabaseName("mydbname");
  12. db.setUserName("myusn");
  13. db.setPassword("mypwd");
  14.  
  15. if (!db.open()) return false;
  16. else return true;
  17. }
  18. #endif // CONNECTION_H
To copy to clipboard, switch view to plain text mode 

I included this header to the mainwindow.h with the line
#include "createconnection.h"
and there's a simple QSqlTableModel output of a table of my database just to see if it works.

And that's all. Whenever I compile the project there is the warning message:
'bool createConnection()' defined but not used
and I get it twice as if it was detected twice.

It is pretty wierd as if it wasn't used, the connection shouldn't be estabilished, should it?