Results 1 to 3 of 3

Thread: data base in qt

  1. #1
    Join Date
    May 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default data base in qt

    hi.
    i wanna make an application that with this you can reserve ticket for your travel , in fact
    designing system of one airline and when i want to create database(some 2d matrix that save number of seat in flights ,it errors.
    the number of flight set in different place and the is changing
    this is my code:

    QString** matrix = new QString*[numberofFlights];
    for (int i = 0; i < numberofFlight; i++)
    {
    matrix[i] = new QString[numberofSeats];
    }


    what class in qt should i use.

    can someone help me ,i 'm in hurry
    thanks

  2. #2
    Join Date
    Jun 2011
    Posts
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: data base in qt

    QGenericMatrix is an option, but the number of row and column is unchangable.

    and for you code:
    QString** matrix = new QString*[numberofFlights];
    for (int i = 0; i < numberofFlight; i++) // is this misspelled?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: data base in qt

    You have built yourself a memory management nightmare there. How about:
    Qt Code:
    1. int numberofFlights = 5;
    2. int numberofSeats = 20;
    3.  
    4. QVector<QVector<QString> > flightMatrix;
    5. flightMatrix.resize(numberofFlights);
    6. foreach(QVector<QString> flight, flightMatrix)
    7. flight.resize(numberofSeats);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Sqlite data base
    By sabbu in forum Newbie
    Replies: 14
    Last Post: 26th May 2011, 02:17
  2. Sqlite data base
    By sabbu in forum Newbie
    Replies: 2
    Last Post: 20th May 2011, 00:43
  3. Sqlite data base
    By sabbu in forum Qt Programming
    Replies: 5
    Last Post: 19th May 2011, 12:57
  4. QTable - Data Base Problem
    By esq in forum Qt Tools
    Replies: 9
    Last Post: 28th May 2007, 00:08
  5. program for working with Data Base(i need it)
    By banakil in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 23:58

Tags for this Thread

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.