Results 1 to 14 of 14

Thread: Problem with the const

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Problem with the const

    Dear All

    I have a function like this

    Qt Code:
    1. double form::calculate(const QString &)
    2. {
    3. id_st= id;
    4. load();
    5.  
    6. return spin->value();
    7. }
    To copy to clipboard, switch view to plain text mode 

    I try to call this function from

    Qt Code:
    1. QVariant CustomSql::data(const QModelIndex &index, int role) const
    2. {
    3.  
    4. QVariant value = QSqlTableModel::data(index, role);
    5. if (value.isValid() && role == Qt::DisplayRole) {
    6. if (index.column() == 5){
    7. calculate(index.sibling(index.row(),3).data().toString());
    8. }
    9. return value.toString().leftJustified(true);
    10. }
    11. return value;
    12. }
    To copy to clipboard, switch view to plain text mode 


    I get the error for discard qualifiers ? How can I solve this one?
    Last edited by aekilic; 8th April 2010 at 22:34.

Similar Threads

  1. Replies: 1
    Last Post: 4th December 2009, 17:03
  2. subclassed const function problem
    By qtneuling in forum Newbie
    Replies: 8
    Last Post: 22nd June 2008, 02:52
  3. const member and const method
    By mickey in forum General Programming
    Replies: 8
    Last Post: 9th April 2008, 09:44
  4. Replies: 2
    Last Post: 6th October 2006, 08:54
  5. could somebody please explain const to me?
    By mikro in forum General Programming
    Replies: 4
    Last Post: 29th September 2006, 14:34

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.