Results 1 to 3 of 3

Thread: QMap corruption

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QMap corruption

    Hi,

    I have a problem with this piece of code:

    Qt Code:
    1. QMap<quint32,quint32> qMap;
    2. qMap[0] = 1;
    3. qMap[1] = 1;
    4. qMap[2] = 1;
    5. qMap[3] = 0;
    6. qMap[4] = 0;
    7. QFont qFontBold = ui.treeWidget->headerItem()->font(0);
    8. qFontBold.setBold(true);
    9. qText << "Hello";
    10. QTreeWidgetItem *pqItem = new QTreeWidgetItem(ui.treeWidget,qText);
    11. pqItem->setFont(1,qFontBold); //This line changes qMap[0] to 0
    12.  
    13. //Here, if I check the value of qMap[0] it contains 0 instead of 1
    14. quint32 qValue = qMap.value(0);
    To copy to clipboard, switch view to plain text mode 

    Using the debugger I can see that when setting the font to the item in the treeWidget, the qMap changes the value on key 0.

    Could anyone try this code if you get the same error. Or maybe I'm doing something wrong?

    Using Qt 4.8.1, Visual Studio 2008 and Windows XP.

    Thanks,
    Last edited by ^NyAw^; 6th March 2013 at 14:53.
    Òscar Llarch i Galán

Similar Threads

  1. [Qt4.8] QML: Text corruption
    By flamaros in forum Qt Programming
    Replies: 11
    Last Post: 28th February 2013, 15:26
  2. Heap corruption detected
    By yaseminyilmaz in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2012, 12:53
  3. Best way to fix a memory corruption issue?
    By agarny in forum Qt Programming
    Replies: 4
    Last Post: 3rd April 2012, 07:20
  4. memory corruption
    By Rambobino in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2010, 21:35
  5. Widget corruption
    By grzywacz in forum Qt Tools
    Replies: 5
    Last Post: 28th May 2006, 11:48

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.