PDA

View Full Version : QTreeWidget - How to get a column text ?



fabriciols
14th October 2008, 15:06
Hello guys,
Im doind this peace of code:


void mfit::insertVideoProperty(char *param_cy, char *value_cy)
{
// Cria o item referente a Tree
QTreeWidgetItem *item = new QTreeWidgetItem(this->ui.videoPropertiesTree);

// Cria a lista de items
QList<QTreeWidgetItem *> itens;

// Adiciona as colunas
item->setText(0, param_cy);
item->setText(1, value_cy);

item->setCheckState(0, Qt::Unchecked);

itens.append(item);

this->ui.videoPropertiesTree->insertTopLevelItems(0, itens);
}


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



Breakpoint 1, mfit::insertVideoProperty (this=0x54529a8, param_cy=0x430a85 "Name", value_cy=0x5515910 "fade_corte_dissolve.avi")
at source/Interface.cpp:335
335 QTreeWidgetItem *item = new QTreeWidgetItem(this->ui.videoPropertiesTree);
(gdb) n
338 QList<QTreeWidgetItem *> itens;
(gdb) n
341 item->setText(0, param_cy);
(gdb) n
342 item->setText(1, value_cy);
(gdb) n
[New thread 5744.0x1668]
344 item->setCheckState(0, Qt::Unchecked);
(gdb) n
346 itens.append(item);
(gdb) n
348 this->ui.videoPropertiesTree->insertTopLevelItems(0, itens);
(gdb) n
349 }
(gdb) print item->text(0)
$11 = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 1250}, alloc = 0, size = 0, data = 0x6a30d132,
clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {
ref = {_q_value = 12}, alloc = 0, size = 0, data = 0x6a30d146, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0,
capacity = 0, reserved = 0, array = {0}}, d = 0x54fd560, static codecForCStrings = 0x0}
(gdb) print item->text(1)
$12 = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 1250}, alloc = 0, size = 0, data = 0x6a30d132,
clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {
ref = {_q_value = 12}, alloc = 0, size = 0, data = 0x6a30d146, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0,
capacity = 0, reserved = 0, array = {0}}, d = 0x54532d8, static codecForCStrings = 0x0}
(gdb)

I get allways size = 0 , and NOTHING in data (data or d) :crying:
How to retrieve a string in QTreeWidgetItem columm ?

caduel
14th October 2008, 16:32
For how to print QStrings in gdb, see http://silmor.de/46.