Results 1 to 2 of 2

Thread: Data type parameters.

  1. #1

    Default Data type parameters.

    Hello
    I have the following class:

    Qt Code:
    1. class Motorista() {
    2. protected:
    3. string name; //or char* name;
    4. string idade;
    5. public:
    6. void insertMotorista(string _name, string _idade) {
    7. name = _name;
    8. idade = _idade;
    9. QSqlQuery query;
    10. query.exec("INSERT INTO motorista (nome, id)" "VALUES ('name', 'idade')");
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 

    I also have a class Ui_Moto:

    Qt Code:
    1. class Ui_moto
    2. {
    3. public:
    4. QLineEdit *name2;
    5. QLineEdit *idade2;
    6. (...)
    7. (...)
    8. }
    To copy to clipboard, switch view to plain text mode 


    Now I want to use the QLineEdit constructor of the class Motorista:

    Qt Code:
    1. void Ui_moto::cad()
    2. {
    3. Motorista* moto = new Motorista();
    4. moto->insertMotorista(name2, idade2); // (LineEdit *name2, QLineEdit *idade2)
    5. }
    To copy to clipboard, switch view to plain text mode 

    In other words, what I'm wanting is to put parameters in the data that the User writes in the form to register a Motorista.

    Can be done?

    Thx
    Last edited by wysota; 28th October 2009 at 09:14. Reason: Changed [quote] to [code]

  2. #2
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Data type parameters.

    I feel sorry, but I barely understand what you want to do :P

    In other words, what I'm wanting is to put parameters in the data that the User writes in the form to register a Motorista.
    did you mean QLineEdit::setText()??

Similar Threads

  1. Convert between a custom data type wrapped in a QVariant
    By darkadept in forum Qt Programming
    Replies: 2
    Last Post: 17th March 2009, 09:07
  2. Best way to display lots of data fast
    By New2QT in forum Newbie
    Replies: 4
    Last Post: 16th October 2008, 22:46
  3. Data type error
    By MrShahi in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2008, 14:01
  4. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  5. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38

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.