Hi
I am currently writing an app that reads information from a database, displays it to a screen, delays for x amount of seconds, then displays some different information.
I'm using QTimer to hadle the dealy but am running into some issues regarding the
QSqlDatabase.
What I do is this:
main()
{
create and open database
call screen1();
}
screen1()
{
read info from database;
display;
QTimer::singleShot(5000,
this,screen2
());
}
screen2()
{
read info from db;
display;
}
main()
{
create and open database
call screen1();
}
screen1()
{
read info from database;
display;
QTimer::singleShot(5000,this,screen2());
}
screen2()
{
read info from db;
display;
}
To copy to clipboard, switch view to plain text mode
The first display method (screen1) works perfectly. However, the second method fails and says "Database not open". If I remove the line with "QTimer::single..." in it and replace it with "screen2();", then it works perfectly, just with no delay, which is obviously a bummer.
I don't understand the deep inner workings of either of these classes so if someone more knowledgable could perhaps point out why they "appear" to be interfering with each other.
They may well nt be, but, as I said, the fact that removing that line removes the problem tend to suggest as such.
Thanks
G
Bookmarks