Reputation: 3070
I have a QTreeWidget declared as following
QTreeWidget * datasiftIdpwTree;
datasiftIdpwTree->setColumnCount(2);
datasiftIdpwTree->headerItem()->setText(0, "Username");
datasiftIdpwTree->headerItem()->setText(1, "Api Key");
it is filled with data using the following slot
void Window::addDatasiftIdpw(QString username, QString apikey)
{
datasiftIdpwTree->addTopLevelItem(new QTreeWidgetItem(QStringList(username) << apikey));
}
I can live view the slot addind data to my tree, the probleme is when accessing the data. I tried using
datasiftIdpwTree->itemAt(x,y)->text(0);
but however the value of x, y I use, it always point to the first item (the one produced when first calling addDatasiftIdpw) Where did I go wrong ?
Upvotes: 1
Views: 1024
Reputation: 3070
I made made a mistake between cooridnates and index. Accessing the i-th element is achived by:
datasiftIdpwThree->topLevelItem(i)->text(0);
Upvotes: 3