Results 1 to 2 of 2

Thread: QTreeWidget - How to get a column text ?

  1. #1
    Join Date
    Sep 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QTreeWidget - How to get a column text ?

    Hello guys,
    Im doind this peace of code:
    Qt Code:
    1. void mfit::insertVideoProperty(char *param_cy, char *value_cy)
    2. {
    3. // Cria o item referente a Tree
    4. QTreeWidgetItem *item = new QTreeWidgetItem(this->ui.videoPropertiesTree);
    5.  
    6. // Cria a lista de items
    7. QList<QTreeWidgetItem *> itens;
    8.  
    9. // Adiciona as colunas
    10. item->setText(0, param_cy);
    11. item->setText(1, value_cy);
    12.  
    13. item->setCheckState(0, Qt::Unchecked);
    14.  
    15. itens.append(item);
    16.  
    17. this->ui.videoPropertiesTree->insertTopLevelItems(0, itens);
    18. }
    To copy to clipboard, switch view to plain text mode 

    And with gdb want see the STRING stored in one QTreeWidgetItem, but, i cant get it , any1 can help me ?

    Qt Code:
    1. Breakpoint 1, mfit::insertVideoProperty (this=0x54529a8, param_cy=0x430a85 "Name", value_cy=0x5515910 "fade_corte_dissolve.avi")
    2. at source/Interface.cpp:335
    3. 335 QTreeWidgetItem *item = new QTreeWidgetItem(this->ui.videoPropertiesTree);
    4. (gdb) n
    5. 338 QList<QTreeWidgetItem *> itens;
    6. (gdb) n
    7. 341 item->setText(0, param_cy);
    8. (gdb) n
    9. 342 item->setText(1, value_cy);
    10. (gdb) n
    11. [New thread 5744.0x1668]
    12. 344 item->setCheckState(0, Qt::Unchecked);
    13. (gdb) n
    14. 346 itens.append(item);
    15. (gdb) n
    16. 348 this->ui.videoPropertiesTree->insertTopLevelItems(0, itens);
    17. (gdb) n
    18. 349 }
    19. (gdb) print item->text(0)
    20. $11 = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 1250}, alloc = 0, size = 0, data = 0x6a30d132,
    21. clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {
    22. ref = {_q_value = 12}, alloc = 0, size = 0, data = 0x6a30d146, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0,
    23. capacity = 0, reserved = 0, array = {0}}, d = 0x54fd560, static codecForCStrings = 0x0}
    24. (gdb) print item->text(1)
    25. $12 = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 1250}, alloc = 0, size = 0, data = 0x6a30d132,
    26. clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {
    27. ref = {_q_value = 12}, alloc = 0, size = 0, data = 0x6a30d146, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0,
    28. capacity = 0, reserved = 0, array = {0}}, d = 0x54532d8, static codecForCStrings = 0x0}
    29. (gdb)
    To copy to clipboard, switch view to plain text mode 
    I get allways size = 0 , and NOTHING in data (data or d)
    How to retrieve a string in QTreeWidgetItem columm ?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeWidget - How to get a column text ?

    For how to print QStrings in gdb, see http://silmor.de/46.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 10:49
  2. QTreeWidget scroll only one column
    By nina1983 in forum Qt Programming
    Replies: 3
    Last Post: 13th August 2008, 16:07
  3. QTreeWidget item editing: want column specificity
    By McKee in forum Qt Programming
    Replies: 12
    Last Post: 10th December 2006, 23:12
  4. Replies: 1
    Last Post: 21st September 2006, 11:37
  5. Change column width in a QTreeWidget
    By mace in forum Qt Programming
    Replies: 2
    Last Post: 27th May 2006, 13:19

Tags for this Thread

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.