Results 1 to 5 of 5

Thread: no matching function error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no matching function error

    The 3rd parameter to QTableWidget::setItem() needs to be a pointer to a QTableWidgetItem. You need to create the QTableWidgetItem on the heap using new, instead of on the stack.

    eg:
    Qt Code:
    1. if(k.tagName() == "name"){tabmovies->setItem(counter,0,new QTableWidgetItem(k.text()));}
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to jord for this useful post:

    arpspatel (16th October 2009)

  3. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: no matching function error

    Hi,

    better use
    Qt Code:
    1. if(k.tagName() == "name"){tabmovies->setItem(counter,0,new QTableWidgetItem(k.text()));}
    2. else if(k.tagName() == "weburl"){ tabmovies->setItem(counter,1,new QTableWidgetItem(k.text())); }
    3. else if(k.tagName() == "year"){tabmovies->setItem(counter,2,new QTableWidgetItem(k.text()));}
    To copy to clipboard, switch view to plain text mode 
    it will make your application faster. Further insertRow is the "wrong" function for you because you always add a empty row at 1 but set the content for the last line. So you probably want use QTableWidget::setRowCount().

  4. The following user says thank you to Lykurg for this useful post:

    arpspatel (16th October 2009)

  5. #3
    Join Date
    Apr 2008
    Posts
    35
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: no matching function error

    Quote Originally Posted by Lykurg View Post
    Hi,

    better use
    Qt Code:
    1. if(k.tagName() == "name"){tabmovies->setItem(counter,0,new QTableWidgetItem(k.text()));}
    2. else if(k.tagName() == "weburl"){ tabmovies->setItem(counter,1,new QTableWidgetItem(k.text())); }
    3. else if(k.tagName() == "year"){tabmovies->setItem(counter,2,new QTableWidgetItem(k.text()));}
    To copy to clipboard, switch view to plain text mode 
    it will make your application faster. Further insertRow is the "wrong" function for you because you always add a empty row at 1 but set the content for the last line. So you probably want use QTableWidget::setRowCount().
    Thanks.. i have a huge xml file, so takes abt 2 mins to read.. but this was quicker

  6. #4
    Join Date
    Apr 2008
    Posts
    35
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: no matching function error

    Quote Originally Posted by jord View Post
    The 3rd parameter to QTableWidget::setItem() needs to be a pointer to a QTableWidgetItem. You need to create the QTableWidgetItem on the heap using new, instead of on the stack.

    eg:
    Qt Code:
    1. if(k.tagName() == "name"){tabmovies->setItem(counter,0,new QTableWidgetItem(k.text()));}
    To copy to clipboard, switch view to plain text mode 
    Thanks man worked instantly... i know i was missing someting simple.. thanks again.

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. Regading Driver to connect Postgresql Database
    By dummystories in forum Installation and Deployment
    Replies: 38
    Last Post: 12th March 2009, 07:19
  3. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  4. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

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.