Bushes
Bushes

Reputation: 1010

QT QstandardItem issue

I'm wondering when declaring:

QStandardItem *baseItem = new QStandardItem("Hello");

How can I get the text I name text I give it (e.g. Hello) later on. For example I'd quite to compare the name I give it with a QString?

Upvotes: 0

Views: 448

Answers (1)

pnezis
pnezis

Reputation: 12321

Have a look at QStandardItem documentation. text() returns what you want :

Returns the item's text. This is the text that's presented to the user in a view.

So for comparing it with a QString you just do :

if (baseItem->text() == anotherString)
   // do something

Upvotes: 1

Related Questions