Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23

Thread: Constructor call problem

  1. #21
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Constructor call problem

    I've changed the code in addEntry() to:
    Qt Code:
    1. void CShoppingCartWidget::addEntry(structOrder& order)
    2. {
    3. // debug block
    4. qDebug() << "order.iMerchandizeID=" << order.iMerchandizeID;
    5. qDebug() << "order.iMerchandizeQuantity=" << order.iMerchandizeQuantity;
    6. qDebug() << "order.rMerchandizePrice=" << order.rMerchandizePrice;
    7. qDebug() << "order.rSubtotal=" << order.rSubtotal;
    8. qDebug() << "order.strDisplayString=" << order.strDisplayString;
    9. qDebug() << "order.strMerchandizeName=" << order.strMerchandizeName;
    10. // **** END of debug block
    11.  
    12. QList<CMerchandizeOrder*> orders=shoppingCartModel()->orders();
    13. //CMerchandizeOrder* tempOrder=new CMerchandizeOrder(order);
    14. //Q_CHECK_PTR(tempOrder);
    15. CMerchandizeOrder tempOrder(order);
    16.  
    17. /*
    18.   tempOrder.iMerchandizeID=order.iMerchandizeID;
    19.   tempOrder.iMerchandizeQuantity=order.iMerchandizeQuantity;
    20.   tempOrder.rMerchandizePrice=order.rMerchandizePrice;
    21.   tempOrder.rSubtotal=order.rSubtotal;
    22.   tempOrder.strDisplayString=order.strDisplayString;
    23.   tempOrder.strMerchandizeName=order.strMerchandizeName;
    24. */
    25.  
    26. if (!orders.contains(&tempOrder))
    27. {
    28. // new merchandize
    29. shoppingCartModel()->insertRows(0, 1, QModelIndex());
    30. QModelIndex index=shoppingCartModel()->index(0, 0, QModelIndex());
    31. shoppingCartModel()->setData(index,
    32. tempOrder.orderValues().strDisplayString,
    33. //tempOrder->orderValues().strDisplayString,
    34. Qt::EditRole);
    35. }
    36. else
    37. {
    38. // merchandize exists, update quantity and subtotal
    39. }
    40. }
    To copy to clipboard, switch view to plain text mode 
    and I get same result.
    Qt 5.3 Opensource & Creator 3.1.2

  2. #22
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Constructor call problem

    The problem has been solved, I've checked all sources related to table widget and I found some merchandize order field reset code from other developer that I did not have been aware god damn!!!! Stupid, stupid, stupid! Anyway, thanks all repliers for your time. But gdb still has problems with setting breakpoints in constructors ...
    Qt 5.3 Opensource & Creator 3.1.2

  3. #23
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Constructor call problem

    relief for me too,,,, i was also begining to bang my head
    i told ya,, u must be overriding somewher

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

    MarkoSan (28th May 2008)

Similar Threads

  1. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 20:17
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  4. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.