本文整理汇总了C++中QStandardItemModel::appendColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ QStandardItemModel::appendColumn方法的具体用法?C++ QStandardItemModel::appendColumn怎么用?C++ QStandardItemModel::appendColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStandardItemModel
的用法示例。
在下文中一共展示了QStandardItemModel::appendColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
void CSVSettings::View::buildUpdatableValueModel (const QStringList &values)
{
//updateable models are standard item models because they support
//replacing entire columns
QList <QStandardItem *> itemList;
foreach (const QString &value, values)
itemList.append (new QStandardItem(value));
QStandardItemModel *model = new QStandardItemModel (this);
model->appendColumn (itemList);
mDataModel = model;
}
示例2: select
void CSVSettings::View::setSelectedValues (const QStringList &list,
bool doViewUpdate, bool signalUpdate) const
{
QItemSelection selection;
if (stringListsMatch (list, selectedValues()))
return;
if (!mHasFixedValues)
{
QStandardItemModel *model =
static_cast <QStandardItemModel *>(mDataModel);
model->clear();
model->appendColumn (toStandardItemList (list));
for (int i = 0; i < model->rowCount(); i++)
{
QModelIndex idx = model->index(i, 0);
selection.append (QItemSelectionRange (idx, idx));
}
}
else
{
for (int i = 0; i < mDataModel->rowCount(); i++)
{
if (list.contains(value(i)))
{
QModelIndex idx = mDataModel->index(i, 0);
selection.append(QItemSelectionRange (idx, idx));
}
}
}
select (selection);
//update the view if the selection was set from the model side, not by the
//user
if (doViewUpdate)
updateView (signalUpdate);
}
示例3: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QStandardItemModel model;
for ( int col = 0; col < 3; col++ )
{
QList<QStandardItem*> list;
for ( int row = 0; row < 5; row++ )
{
list.append(new QStandardItem);
}
model.appendColumn(list);
}
TableView view;
view.setModel(&model);
view.show();
return a.exec();
}