我想知道什么时候声明:
QStandardItem *baseItem = new QStandardItem("Hello");
我怎样才能得到我稍后给它命名的文本(例如你好)。例如,我很愿意将我给它的名称与 QString 进行比较?
最佳答案
看看QStandardItem
文档。 text()
返回你想要的:
Returns the item's text. This is the text that's presented to the user in a view.
因此,为了将它与 QString 进行比较,您只需执行以下操作:
if (baseItem->text() == anotherString)
// do something
关于c++ - QT QstandardItem问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8095674/