本文整理汇总了C++中ArrayView::resizeColumnsToContents方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayView::resizeColumnsToContents方法的具体用法?C++ ArrayView::resizeColumnsToContents怎么用?C++ ArrayView::resizeColumnsToContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayView
的用法示例。
在下文中一共展示了ArrayView::resizeColumnsToContents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEditorData
//-----------------------------------------------------------------------------
// Function: ParameterDelegate::setEditorData()
//-----------------------------------------------------------------------------
void ParameterDelegate::setEditorData(QWidget* editor, QModelIndex const& index) const
{
if (index.column() == valueColumn() && valueIsArray(index))
{
ArrayView* view = dynamic_cast<ArrayView*>(dynamic_cast<QScrollArea*>(editor)->widget());
QModelIndex arrayLeftIndex = index.sibling(index.row(), arrayLeftColumn());
int arrayLeftValue = arrayLeftIndex.data(Qt::ToolTipRole).toInt();
QModelIndex arrayRightIndex = index.sibling(index.row(), arrayRightColumn());
int arrayRightValue = arrayRightIndex.data(Qt::ToolTipRole).toInt();
int arraySize = getArraySize(arrayLeftValue, arrayRightValue);
int arrayStartIndex = arrayLeftValue;
if (arrayRightValue < arrayLeftValue)
{
arrayStartIndex = arrayRightValue;
}
QSharedPointer<IPXactSystemVerilogParser> expressionParser(new IPXactSystemVerilogParser(
getParameterFinder()));
QSharedPointer<Choice> selectedChoice = findChoice(index);
ParameterArrayModel* model = new ParameterArrayModel(arraySize, expressionParser, getParameterFinder(),
expressionFormatter_, selectedChoice, QColor("LemonChiffon"), arrayStartIndex, view);
QModelIndex valueIndex = index.sibling(index.row(), valueColumn());
QString parameterValue = valueIndex.data(Qt::EditRole).toString();
model->setArrayData(parameterValue);
QModelIndex typeIndex = index.sibling(index.row(), formatColumn());
QString parameterType = typeIndex.data(Qt::EditRole).toString();
model->setParameterType(parameterType);
view->setItemDelegate(new ArrayDelegate(getNameCompleter(), getParameterFinder(), selectedChoice,
this->parent()));
view->setModel(model);
view->setSortingEnabled(false);
view->resizeColumnsToContents();
connect(model, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
connect(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
this, SIGNAL(contentChanged()), Qt::UniqueConnection);
connect(view->itemDelegate(), SIGNAL(increaseReferences(QString)),
this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
connect(view->itemDelegate(), SIGNAL(decreaseReferences(QString)),
this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);
}
示例2: setArrayEditor
//-----------------------------------------------------------------------------
// Function: RemapConditionDelegate::setArrayEditor()
//-----------------------------------------------------------------------------
void RemapConditionDelegate::setArrayEditor(QWidget* editor, QModelIndex const& index) const
{
ArrayView* view = dynamic_cast<ArrayView*>(dynamic_cast<QScrollArea*>(editor)->widget());
int arraySize = getPortWidth(index);
QSharedPointer<IPXactSystemVerilogParser> expressionParser(new IPXactSystemVerilogParser(
getParameterFinder()));
QModelIndex portLeftIndex = index.sibling(index.row(), RemapConditionColumns::LEFT_COLUMN);
int portLeft = portLeftIndex.data(Qt::ToolTipRole).toInt();
QModelIndex portRightIndex = index.sibling(index.row(), RemapConditionColumns::RIGHT_COLUMN);
int portRight = portRightIndex.data(Qt::ToolTipRole).toInt();
int arrayStart = portLeft;
if (portRight < portLeft)
{
arrayStart = portRight;
}
ParameterArrayModel* model = new ParameterArrayModel(arraySize, expressionParser, getParameterFinder(),
expressionFormatter_, QSharedPointer<Choice>(new Choice()), QColor("white"), arrayStart, view);
QModelIndex valueIndex = index.sibling(index.row(), RemapConditionColumns::VALUE_COLUMN);
QString portValue = valueIndex.data(Qt::EditRole).toString();
model->setArrayData(portValue);
view->setItemDelegate(new ArrayDelegate(getNameCompleter(), getParameterFinder(),
QSharedPointer<Choice>(new Choice()), this->parent()));
view->setModel(model);
view->setSortingEnabled(false);
view->resizeColumnsToContents();
connect(model, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
connect(view->itemDelegate(), SIGNAL(increaseReferences(QString)),
this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
connect(view->itemDelegate(), SIGNAL(decreaseReferences(QString)),
this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);
}