本文整理汇总了C++中TableItem::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ TableItem::setText方法的具体用法?C++ TableItem::setText怎么用?C++ TableItem::setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableItem
的用法示例。
在下文中一共展示了TableItem::setText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHorizontalHeaderItem
void
TableView::setHorizontalHeaderLabels(const QStringList &labels)
{
TableItem *item = 0;
for (int i = 0; i < _imp->model->columnCount() && i < labels.count(); ++i) {
item = _imp->model->horizontalHeaderItem(i);
if (!item) {
item = _imp->model->createItem();
setHorizontalHeaderItem(i, item);
}
item->setText( labels.at(i) );
}
}
示例2: updateThisFromNode
void KeyValuesTable::updateThisFromNode(HaveKeyValueData *hv, bool isReadOnly)
{
if (!isReadOnly)
{
if(numCols() == 2)
insertColumns(2);
horizontalHeader()->setLabel(2, TR("do"));
}
else
{
if(numCols() == 3)
removeColumn(2);
}
int index;
int sup = 0;
if(hv)
sup = hv->get_n_keys();
int rowCount = numRows();
for (index = rowCount - 1; index > sup; index -= 1)
removeRow(index);
if (isReadOnly)
{
for (index = 0; index < sup; index += 1)
{
TableItem * tiKey = nullptr;
TableItem * tiValue = nullptr;
QString s = toUnicode(hv->get_value(index));
int n = s.count('\n');
if(index == numRows() || numRows() == 0)
{
tiKey = new TableItem(this, Q3TableItem::Never,
toUnicode(hv->get_key(index)));
tiValue = new TableItem(this, Q3TableItem::Never, s);
setItem(index, 0, tiKey);
setItem(index, 1, tiValue);
}
else
{
tiKey = dynamic_cast<TableItem*>(item(index, 0));
tiKey->setText(hv->get_key(index));
tiValue = dynamic_cast<TableItem*>(item(index, 1));
tiValue->setText(s);
}
tiKey->setReplaceable(FALSE);
tiValue->setReplaceable(FALSE);
if (n != 0)
{
// note : adjustRow(index) does nothing
setRowHeight(index, rowHeight(index) * (n + 1));
}
}
}
else
{
props.setAutoDelete(TRUE);
QStringList items;
for (index = 0; index < sup; index += 1)
{
QString k = toUnicode(hv->get_key(index));
QString v = toUnicode(hv->get_value(index));
QStringList * psl = props[k];
setText(index, 0, k);
if (psl != 0)
setItem(index, 1, new ComboItem(this, v, *psl, FALSE));
if ((k.contains(':') == 2) &&
ProfiledStereotypes::enumerated(k, items)) {
psl = new QStringList(items);
props.insert(k, psl);
setItem(index, 1, new ComboItem(this, v, *psl, FALSE));
}
else
setItem(index, 1, new MLinesItem(this, v));
setText(index, 2, QString());
setRowStretchable(index, TRUE);
}
if(index == numRows())
insertRows(numRows());
setText(index, 0, QString());
setItem(index, 1, new MLinesItem(this, QString()));
setText(index, 2, QString());
setRowStretchable(index, TRUE);
}
horizontalHeader()->setResizeEnabled(TRUE, 0); //setColumnStretchable (0, TRUE);
setColumnStretchable(1, TRUE);
if (! isReadOnly) {
//.........这里部分代码省略.........