Results 1 to 1 of 1

Thread: Compiling error with list.count

  1. #1
    Join Date
    Feb 2012
    Posts
    13
    Qt products
    Qt4

    Default Re: Compiling error with list.count

    Hi, Ive started to make a database edit program, and I have an error

    Here's code:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtSql/QSqlDatabase>
    3. #include <QtSql/QSqlQuery>
    4. #include <QWidget>
    5. #include "widget.h"
    6. #include <QtDebug>
    7. #include <QGridLayout>
    8. int main(int argc, char *argv[])
    9. {
    10.  
    11. QApplication a(argc, argv);
    12. QWidget qw;
    13. QList<QLineEdit*> list;
    14. for(int i = 0; i < 2; i++) {
    15. list.append(new QLineEdit());
    16. }
    17. QGridLayout *ql = new QGridLayout();
    18. for(int a = 0; a < list.count; a++) {
    19. ql->addWidget(list[a]);
    20. }
    21. qw.setLayout(ql);
    22. qw.setFixedSize(200, 200);
    23. qw.show();
    24.  
    25. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    26. db.setHostName("localhost");
    27. db.setDatabaseName("test");
    28. db.setUserName("root");
    29. db.setPassword("secret");
    30. bool ok = db.open();
    31. if(ok) {
    32.  
    33. }
    34. return a.exec();
    35. }
    To copy to clipboard, switch view to plain text mode 

    And error:
    Qt Code:
    1. /home/marcus/untitled-build-desktop-Qt_4_8_1_in_PATH__System__Release/../untitled/main.cpp:18: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
    To copy to clipboard, switch view to plain text mode 

    I think the problem is in the for loop with list.count
    Ty for answer.


    Added after 1 3 minutes:


    Too late, fixed xd

    it was list.count() not list.count
    Last edited by xleniz; 9th June 2012 at 12:27.

Similar Threads

  1. Replies: 14
    Last Post: 16th May 2017, 03:51
  2. [Help] Error while Compiling
    By Lapje in forum Newbie
    Replies: 8
    Last Post: 4th January 2011, 23:10
  3. Error while compiling qt
    By deemeetar in forum Installation and Deployment
    Replies: 1
    Last Post: 1st August 2009, 20:26
  4. Replies: 1
    Last Post: 25th October 2008, 19:18
  5. QList<myObject*> myObjectList count() error
    By morty in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2006, 15:08

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.