Results 1 to 18 of 18

Thread: QString problem...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QString problem...

    What exactly "doesn't work"?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Sep 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    28

    Default Re: QString problem...

    @wysota

    it simply doesn't open up any databases, when requested to do so

    @at the other guys
    will try qdebug and then post another reply with the results

  3. #3
    Join Date
    Sep 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    28

    Default Re: QString problem...

    well I did play with qDebug for a while it tells me that well, here are the results:

    we are in openfile() now
    database opened
    path not empty

    one thing I added qDebug() << "database opened"
    as part of that if that tests if the database is opened (in loaddatabase() ),
    so aparently the problem doesn't lie in the path String.

    Any ideas where it might lie?

    If you need any code I will show it upon request

    Thanks in advance

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QString problem...

    Did you try asking the database what the problem was?
    QSqlDatabase::lastError()
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    Nefastious (27th September 2009)

  6. #5
    Join Date
    Sep 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    28

    Default Re: QString problem...

    By using

    Qt Code:
    1. qDebug() << db.lastError();
    To copy to clipboard, switch view to plain text mode 

    I get the following:

    QSqlError(-1, "", "")

    What does this mean?

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QString problem...

    It means there is no error in the database object. How do you know the database failed to open?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. The following user says thank you to wysota for this useful post:

    Nefastious (29th September 2009)

  9. #7
    Join Date
    Sep 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    28

    Default Re: QString problem...

    Well,

    there is a model connected to the database and then a TableView connected to the model, and the View remains blank after I supposedly load the database...


    Any ideas?

  10. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QString problem...

    Quote Originally Posted by Nefastious View Post
    there is a model connected to the database and then a TableView connected to the model, and the View remains blank after I supposedly load the database...
    It doesn't mean the database failed to open!

    What do QSqlDatabase::open() and QSqlDatabase::isOpen() return?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. The following user says thank you to wysota for this useful post:

    Nefastious (29th September 2009)

  12. #9
    Join Date
    Sep 2009
    Posts
    34
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    28

    Default Re: QString problem...

    true on both

    so we can assume that the problem doesn't lie on the database object itself, but where could it lie? Any ideas?

  13. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QString problem...

    The query is probably incorrect or the table is empty. Check the last error of the model.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. The following user says thank you to wysota for this useful post:

    Nefastious (29th September 2009)

Similar Threads

  1. problem copying files and unmount drives
    By alejo in forum Qt Programming
    Replies: 2
    Last Post: 14th July 2009, 21:54
  2. Replies: 9
    Last Post: 6th May 2009, 11:09
  3. QString problem?
    By raphaelf in forum Newbie
    Replies: 7
    Last Post: 24th June 2008, 10:12
  4. char* to QString. Segfault after delete []
    By TheRonin in forum Qt Programming
    Replies: 9
    Last Post: 19th June 2008, 14:20
  5. QHash non-ANSI key problem
    By roxton in forum Qt Programming
    Replies: 4
    Last Post: 27th May 2008, 16:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.