Results 1 to 4 of 4

Thread: QtSql or QtSql/ ?

  1. #1
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QtSql or QtSql/ ?

    Hi,

    I would like to try some simple database-connection. I opened the cachedtable example in the Creator which works fine. Then I started a brand new project, chose "Qt Gui application" and here is where I got lost... Ok, this is not my first Qt project, but this time there are things I can't get.

    So. In the example there is
    #include <QApplication>
    In my one it is:
    #include <QtGui/QApplication>
    by default. First: what is the difference?

    The second might be a related question.
    There is the "connection.h" in that example, which I simply copied into my project. (Add new -> c++ source file -> and then simply copy-pasted the example header code, it's just the error message box that I throw out.) I included this file with #include "connection.h" in the mainwindow.h, and tried to build this project, but this did not work. It complains for all the included libraries in the heades saying "No such file or directory.".

    I tryed to change the include lines like #include <QtSql/...> but it does not work at all.

    So what do I not understand? I'm a bit confused... :S
    Szilvi

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

    Default Re: QtSql or QtSql/ ?

    Add QT+=sql to your project file.
    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.


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

    szisziszilvi (8th March 2011)

  4. #3
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtSql or QtSql/ ?

    wow why can the "I'm lost in the forest" questions always be answered in no more characters as many fingers one have...
    anyway, I would still be interested in the question about this <QApplication> thing.
    Szilvi

  5. #4
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QtSql or QtSql/ ?

    #include <QApplication>
    In my one it is:
    #include <QtGui/QApplication>
    by default. First: what is the difference?
    hi,
    both are referring to the same file only. u can use any of them.
    First one simply includes the QApplication.
    The second one's meaning is:
    There are many modules in QtGui. you are only loading the QtGui's QApplication module.
    press f2 in QApplication word u will see this #include "qapplication.h" again press f2 in qapplication.h, u will get the exact header file location

    hope it helps

Similar Threads

  1. QtService & QtSql
    By acedanans in forum Qt Programming
    Replies: 11
    Last Post: 3rd October 2014, 12:30
  2. My compiler can't find QtSql
    By codymarc in forum Newbie
    Replies: 1
    Last Post: 1st October 2010, 14:52
  3. about Windows Ado and QtSql
    By lutins in forum General Programming
    Replies: 1
    Last Post: 1st September 2008, 20:04
  4. problem of QtSql
    By cresthong in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2008, 17:48
  5. QTSql String Quoteing
    By ldsjohn in forum Qt Programming
    Replies: 6
    Last Post: 5th December 2006, 00:12

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.